9
9
from fileformats .core .exceptions import FormatConversionError
10
10
from conftest import write_test_file
11
11
12
- try :
13
- import pydra .mark
14
- except ImportError :
15
- pydra = None
16
12
17
-
18
- @pytest .fixture (scope = "session" )
19
- def foo_bar_converter ():
13
+ @pytest .fixture
14
+ def FooBarConverter ():
20
15
work_dir = Path (tempfile .mkdtemp ())
21
16
22
17
@converter
23
18
@python .define (outputs = {"out_file" : Bar }) # type: ignore[misc]
24
- def foo_bar_converter_ (in_file : Foo ):
19
+ def FooBarConverter_ (in_file : Foo ):
25
20
return Bar (write_test_file (work_dir / "bar.bar" , in_file .raw_contents ))
26
21
27
- return foo_bar_converter_
22
+ return FooBarConverter_
28
23
29
24
30
- @pytest .fixture ( scope = "session" )
31
- def baz_bar_converter ():
25
+ @pytest .fixture
26
+ def BazBarConverter ():
32
27
work_dir = Path (tempfile .mkdtemp ())
33
28
34
29
@converter (out_file = "out" )
35
30
@python .define (outputs = {"out" : Bar }) # type: ignore[misc]
36
- def baz_bar_converter_ (in_file : Baz ):
31
+ def BazBarConverter_ (in_file : Baz ):
37
32
assert in_file
38
33
return Bar (write_test_file (work_dir / "bar.bar" , in_file .raw_contents ))
39
34
40
- return baz_bar_converter_
35
+ return BazBarConverter_
41
36
42
37
43
- @pytest .fixture ( scope = "session" )
38
+ @pytest .fixture
44
39
def FooQuxConverter ():
45
40
@converter (source_format = Foo , target_format = Qux )
46
41
@shell .define
@@ -60,25 +55,20 @@ class Outputs(shell.Outputs):
60
55
return FooQuxConverter_
61
56
62
57
63
- @pytest .mark .skipif (pydra is None , reason = "Pydra could not be imported" )
64
- def test_get_converter_functask (foo_bar_converter , work_dir ):
58
+ def test_get_converter_functask (FooBarConverter , work_dir ):
65
59
66
60
fspath = work_dir / "test.foo"
67
61
write_test_file (fspath )
68
- assert attrs .asdict (Bar .get_converter (Foo ).task ) == attrs .asdict (
69
- foo_bar_converter ()
70
- )
62
+ assert attrs .asdict (Bar .get_converter (Foo ).task ) == attrs .asdict (FooBarConverter ())
71
63
72
64
73
- @pytest .mark .skipif (pydra is None , reason = "Pydra could not be imported" )
74
65
def test_get_converter_shellcmd (FooQuxConverter , work_dir ):
75
66
76
67
fspath = work_dir / "test.foo"
77
68
write_test_file (fspath )
78
69
assert attrs .asdict (Qux .get_converter (Foo ).task ) == attrs .asdict (FooQuxConverter ())
79
70
80
71
81
- @pytest .mark .skipif (pydra is None , reason = "Pydra could not be imported" )
82
72
def test_get_converter_fail (work_dir ):
83
73
84
74
fspath = work_dir / "test.foo"
@@ -87,8 +77,7 @@ def test_get_converter_fail(work_dir):
87
77
Baz .get_converter (Foo )
88
78
89
79
90
- @pytest .mark .skipif (pydra is None , reason = "Pydra could not be imported" )
91
- def test_convert_functask (foo_bar_converter , work_dir ):
80
+ def test_convert_functask (FooBarConverter , work_dir ):
92
81
93
82
fspath = work_dir / "test.foo"
94
83
write_test_file (fspath )
@@ -98,7 +87,6 @@ def test_convert_functask(foo_bar_converter, work_dir):
98
87
assert bar .raw_contents == foo .raw_contents
99
88
100
89
101
- @pytest .mark .skipif (pydra is None , reason = "Pydra could not be imported" )
102
90
def test_convert_shellcmd (FooQuxConverter , work_dir ):
103
91
104
92
fspath = work_dir / "test.foo"
@@ -109,8 +97,7 @@ def test_convert_shellcmd(FooQuxConverter, work_dir):
109
97
assert qux .raw_contents == foo .raw_contents
110
98
111
99
112
- @pytest .mark .skipif (pydra is None , reason = "Pydra could not be imported" )
113
- def test_convert_mapped_conversion (baz_bar_converter , work_dir ):
100
+ def test_convert_mapped_conversion (BazBarConverter , work_dir ):
114
101
115
102
fspath = work_dir / "test.baz"
116
103
write_test_file (fspath )
0 commit comments