16
16
17
17
18
18
@pytest .fixture (name = "mock_x2sys_home" )
19
- def fixture_mock_x2sys_home (monkeypatch ):
19
+ def _fixture_mock_x2sys_home (monkeypatch ):
20
20
"""
21
21
Set the X2SYS_HOME environment variable to the current working directory
22
22
for the test session.
@@ -34,7 +34,8 @@ def fixture_tracks():
34
34
return [dataframe .query (expr = "z > -20" )] # reduce size of dataset
35
35
36
36
37
- def test_x2sys_cross_input_file_output_file (mock_x2sys_home ):
37
+ @pytest .mark .usefixture ("mock_x2sys_home" )
38
+ def test_x2sys_cross_input_file_output_file ():
38
39
"""
39
40
Run x2sys_cross by passing in a filename, and output internal crossovers to
40
41
an ASCII txt file.
@@ -52,7 +53,8 @@ def test_x2sys_cross_input_file_output_file(mock_x2sys_home):
52
53
_ = pd .read_csv (outfile , sep = "\t " , header = 2 ) # ensure ASCII text file loads ok
53
54
54
55
55
- def test_x2sys_cross_input_file_output_dataframe (mock_x2sys_home ):
56
+ @pytest .mark .usefixture ("mock_x2sys_home" )
57
+ def test_x2sys_cross_input_file_output_dataframe ():
56
58
"""
57
59
Run x2sys_cross by passing in a filename, and output internal crossovers to
58
60
a pandas.DataFrame.
@@ -69,7 +71,8 @@ def test_x2sys_cross_input_file_output_dataframe(mock_x2sys_home):
69
71
assert columns [6 :] == ["head_1" , "head_2" , "vel_1" , "vel_2" , "z_X" , "z_M" ]
70
72
71
73
72
- def test_x2sys_cross_input_dataframe_output_dataframe (mock_x2sys_home , tracks ):
74
+ @pytest .mark .usefixture ("mock_x2sys_home" )
75
+ def test_x2sys_cross_input_dataframe_output_dataframe (tracks ):
73
76
"""
74
77
Run x2sys_cross by passing in one dataframe, and output internal crossovers
75
78
to a pandas.DataFrame.
@@ -89,7 +92,8 @@ def test_x2sys_cross_input_dataframe_output_dataframe(mock_x2sys_home, tracks):
89
92
assert output .dtypes ["i_2" ].type == np .object_
90
93
91
94
92
- def test_x2sys_cross_input_two_dataframes (mock_x2sys_home ):
95
+ @pytest .mark .usefixture ("mock_x2sys_home" )
96
+ def test_x2sys_cross_input_two_dataframes ():
93
97
"""
94
98
Run x2sys_cross by passing in two pandas.DataFrame tables with a time
95
99
column, and output external crossovers to a pandas.DataFrame.
@@ -125,7 +129,8 @@ def test_x2sys_cross_input_two_dataframes(mock_x2sys_home):
125
129
assert output .dtypes ["t_2" ].type == np .datetime64
126
130
127
131
128
- def test_x2sys_cross_input_dataframe_with_nan (mock_x2sys_home , tracks ):
132
+ @pytest .mark .usefixture ("mock_x2sys_home" )
133
+ def test_x2sys_cross_input_dataframe_with_nan (tracks ):
129
134
"""
130
135
Run x2sys_cross by passing in one dataframe with NaN values, and output
131
136
internal crossovers to a pandas.DataFrame.
@@ -148,7 +153,8 @@ def test_x2sys_cross_input_dataframe_with_nan(mock_x2sys_home, tracks):
148
153
assert output .dtypes ["i_2" ].type == np .object_
149
154
150
155
151
- def test_x2sys_cross_input_two_filenames (mock_x2sys_home ):
156
+ @pytest .mark .usefixture ("mock_x2sys_home" )
157
+ def test_x2sys_cross_input_two_filenames ():
152
158
"""
153
159
Run x2sys_cross by passing in two filenames, and output external crossovers
154
160
to a pandas.DataFrame.
@@ -186,7 +192,8 @@ def test_x2sys_cross_invalid_tracks_input_type(tracks):
186
192
x2sys_cross (tracks = [invalid_tracks ])
187
193
188
194
189
- def test_x2sys_cross_region_interpolation_numpoints (mock_x2sys_home ):
195
+ @pytest .mark .usefixture ("mock_x2sys_home" )
196
+ def test_x2sys_cross_region_interpolation_numpoints ():
190
197
"""
191
198
Test that x2sys_cross's region (R), interpolation (l) and numpoints (W)
192
199
arguments work.
@@ -210,7 +217,8 @@ def test_x2sys_cross_region_interpolation_numpoints(mock_x2sys_home):
210
217
npt .assert_allclose (output .z_M .mean (), - 2890.465813 )
211
218
212
219
213
- def test_x2sys_cross_trackvalues (mock_x2sys_home ):
220
+ @pytest .mark .usefixture ("mock_x2sys_home" )
221
+ def test_x2sys_cross_trackvalues ():
214
222
"""
215
223
Test that x2sys_cross's trackvalues (Z) argument work.
216
224
"""
0 commit comments