@@ -17,30 +17,33 @@ def test_tomography_context_initialisation_for_tomo(tmp_path):
1717@patch ("requests.get" )
1818@patch ("requests.post" )
1919def test_tomography_context_add_tomo_tilt (mock_post , mock_get , tmp_path ):
20+ mock_post ().status_code = 200
21+
2022 env = MurfeyInstanceEnvironment (
2123 url = urlparse ("http://localhost:8000" ),
2224 client_id = 0 ,
2325 sources = [tmp_path ],
2426 default_destinations = {tmp_path : str (tmp_path )},
2527 )
2628 context = TomographyContext ("tomo" , tmp_path )
27- (tmp_path / "Position_1_ [30.0]_fractions .tiff" ).touch ()
29+ (tmp_path / "Position_1_001_ [30.0]_date_time_fractions .tiff" ).touch ()
2830 context .post_transfer (
29- tmp_path / "Position_1_ [30.0]_fractions .tiff" ,
31+ tmp_path / "Position_1_001_ [30.0]_date_time_fractions .tiff" ,
3032 role = "detector" ,
3133 required_position_files = [],
3234 required_strings = ["fractions" ],
3335 environment = env ,
3436 )
3537 assert context ._tilt_series == {
36- "Position_1" : [tmp_path / "Position_1_ [30.0]_fractions .tiff" ]
38+ "Position_1" : [tmp_path / "Position_1_001_ [30.0]_date_time_fractions .tiff" ]
3739 }
3840 assert (
39- context ._last_transferred_file == tmp_path / "Position_1_[30.0]_fractions.tiff"
41+ context ._last_transferred_file
42+ == tmp_path / "Position_1_001_[30.0]_date_time_fractions.tiff"
4043 )
41- (tmp_path / "Position_1_ [-30.0]_fractions .tiff" ).touch ()
44+ (tmp_path / "Position_1_002_ [-30.0]_date_time_fractions .tiff" ).touch ()
4245 context .post_transfer (
43- tmp_path / "Position_1_ [-30.0]_fractions .tiff" ,
46+ tmp_path / "Position_1_002_ [-30.0]_date_time_fractions .tiff" ,
4447 role = "detector" ,
4548 required_position_files = [],
4649 required_strings = ["fractions" ],
@@ -61,9 +64,9 @@ def test_tomography_context_add_tomo_tilt(mock_post, mock_get, tmp_path):
6164 assert context ._completed_tilt_series == ["Position_1" ]
6265
6366 # Start Position_2, this is not complete
64- (tmp_path / "Position_2_ [30.0]_fractions .tiff" ).touch ()
67+ (tmp_path / "Position_2_002_ [30.0]_date_time_fractions .tiff" ).touch ()
6568 context .post_transfer (
66- tmp_path / "Position_2_ [30.0]_fractions .tiff" ,
69+ tmp_path / "Position_2_002_ [30.0]_date_time_fractions .tiff" ,
6770 role = "detector" ,
6871 required_position_files = [],
6972 required_strings = ["fractions" ],
@@ -76,60 +79,63 @@ def test_tomography_context_add_tomo_tilt(mock_post, mock_get, tmp_path):
7679@patch ("requests.get" )
7780@patch ("requests.post" )
7881def test_tomography_context_add_tomo_tilt_out_of_order (mock_post , mock_get , tmp_path ):
82+ mock_post ().status_code = 200
83+
7984 env = MurfeyInstanceEnvironment (
8085 url = urlparse ("http://localhost:8000" ),
8186 client_id = 0 ,
8287 sources = [tmp_path ],
8388 default_destinations = {tmp_path : str (tmp_path )},
8489 )
8590 context = TomographyContext ("tomo" , tmp_path )
86- (tmp_path / "Position_1_ [30.0]_fractions .tiff" ).touch ()
91+ (tmp_path / "Position_1_001_ [30.0]_date_time_fractions .tiff" ).touch ()
8792 context .post_transfer (
88- tmp_path / "Position_1_ [30.0]_fractions .tiff" ,
93+ tmp_path / "Position_1_001_ [30.0]_date_time_fractions .tiff" ,
8994 role = "detector" ,
9095 required_position_files = [],
9196 required_strings = ["fractions" ],
9297 environment = env ,
9398 )
9499 assert context ._tilt_series == {
95- "Position_1" : [tmp_path / "Position_1_ [30.0]_fractions .tiff" ]
100+ "Position_1" : [tmp_path / "Position_1_001_ [30.0]_date_time_fractions .tiff" ]
96101 }
97102 assert (
98- context ._last_transferred_file == tmp_path / "Position_1_[30.0]_fractions.tiff"
103+ context ._last_transferred_file
104+ == tmp_path / "Position_1_001_[30.0]_date_time_fractions.tiff"
99105 )
100- (tmp_path / "Position_1_ [-30.0]_fractions .tiff" ).touch ()
106+ (tmp_path / "Position_1_002_ [-30.0]_date_time_fractions .tiff" ).touch ()
101107 context .post_transfer (
102- tmp_path / "Position_1_ [-30.0]_fractions .tiff" ,
108+ tmp_path / "Position_1_002_ [-30.0]_date_time_fractions .tiff" ,
103109 role = "detector" ,
104110 required_position_files = [],
105111 required_strings = ["fractions" ],
106112 environment = env ,
107113 )
108114 assert not context ._completed_tilt_series
109- (tmp_path / "Position_2_ [-30.0]_fractions .tiff" ).touch ()
115+ (tmp_path / "Position_2_002_ [-30.0]_date_time_fractions .tiff" ).touch ()
110116 context .post_transfer (
111- tmp_path / "Position_2_ [-30.0]_fractions .tiff" ,
117+ tmp_path / "Position_2_002_ [-30.0]_date_time_fractions .tiff" ,
112118 role = "detector" ,
113119 required_position_files = [],
114120 required_strings = ["fractions" ],
115121 environment = env ,
116122 )
117123 assert len (context ._tilt_series .values ()) == 2
118124 assert not context ._completed_tilt_series
119- (tmp_path / "Position_2_ [30.0]_fractions .tiff" ).touch ()
125+ (tmp_path / "Position_2_001_ [30.0]_date_time_fractions .tiff" ).touch ()
120126 context .post_transfer (
121- tmp_path / "Position_2_ [30.0]_fractions .tiff" ,
127+ tmp_path / "Position_2_001_ [30.0]_date_time_fractions .tiff" ,
122128 role = "detector" ,
123129 required_position_files = [],
124130 required_strings = ["fractions" ],
125131 environment = env ,
126132 )
127133 assert len (context ._tilt_series .values ()) == 2
128134 assert not context ._completed_tilt_series
129- (tmp_path / "Position_3_ [30.0]_fractions .tiff" ).touch ()
130- (tmp_path / "Position_3_ [-30.0]_fractions .tiff" ).touch ()
135+ (tmp_path / "Position_3_001_ [30.0]_date_time_fractions .tiff" ).touch ()
136+ (tmp_path / "Position_3_002_ [-30.0]_date_time_fractions .tiff" ).touch ()
131137 context .post_transfer (
132- tmp_path / "Position_3_ [-30.0]_fractions .tiff" ,
138+ tmp_path / "Position_3_002_ [-30.0]_date_time_fractions .tiff" ,
133139 role = "detector" ,
134140 required_position_files = [],
135141 required_strings = ["fractions" ],
@@ -166,30 +172,33 @@ def test_tomography_context_add_tomo_tilt_out_of_order(mock_post, mock_get, tmp_
166172@patch ("requests.get" )
167173@patch ("requests.post" )
168174def test_tomography_context_add_tomo_tilt_delayed_tilt (mock_post , mock_get , tmp_path ):
175+ mock_post ().status_code = 200
176+
169177 env = MurfeyInstanceEnvironment (
170178 url = urlparse ("http://localhost:8000" ),
171179 client_id = 0 ,
172180 sources = [tmp_path ],
173181 default_destinations = {tmp_path : str (tmp_path )},
174182 )
175183 context = TomographyContext ("tomo" , tmp_path )
176- (tmp_path / "Position_1_ [30.0]_fractions .tiff" ).touch ()
184+ (tmp_path / "Position_1_001_ [30.0]_date_time_fractions .tiff" ).touch ()
177185 context .post_transfer (
178- tmp_path / "Position_1_ [30.0]_fractions .tiff" ,
186+ tmp_path / "Position_1_001_ [30.0]_date_time_fractions .tiff" ,
179187 role = "detector" ,
180188 required_position_files = [],
181189 required_strings = ["fractions" ],
182190 environment = env ,
183191 )
184192 assert context ._tilt_series == {
185- "Position_1" : [tmp_path / "Position_1_ [30.0]_fractions .tiff" ]
193+ "Position_1" : [tmp_path / "Position_1_001_ [30.0]_date_time_fractions .tiff" ]
186194 }
187195 assert (
188- context ._last_transferred_file == tmp_path / "Position_1_[30.0]_fractions.tiff"
196+ context ._last_transferred_file
197+ == tmp_path / "Position_1_001_[30.0]_date_time_fractions.tiff"
189198 )
190- (tmp_path / "Position_1_ [-30.0]_fractions .tiff" ).touch ()
199+ (tmp_path / "Position_1_002_ [-30.0]_date_time_fractions .tiff" ).touch ()
191200 context .post_transfer (
192- tmp_path / "Position_1_ [-30.0]_fractions .tiff" ,
201+ tmp_path / "Position_1_002_ [-30.0]_date_time_fractions .tiff" ,
193202 role = "detector" ,
194203 required_position_files = [],
195204 required_strings = ["fractions" ],
@@ -210,9 +219,9 @@ def test_tomography_context_add_tomo_tilt_delayed_tilt(mock_post, mock_get, tmp_
210219 assert not context ._completed_tilt_series
211220
212221 # Now add the tilt which completes the series
213- (tmp_path / "Position_1_ [60.0]_fractions .tiff" ).touch ()
222+ (tmp_path / "Position_1_003_ [60.0]_data_time_fractions .tiff" ).touch ()
214223 new_series = context .post_transfer (
215- tmp_path / "Position_1_ [60.0]_fractions .tiff" ,
224+ tmp_path / "Position_1_003_ [60.0]_data_time_fractions .tiff" ,
216225 role = "detector" ,
217226 required_position_files = [],
218227 required_strings = ["fractions" ],
@@ -233,6 +242,8 @@ def test_tomography_context_initialisation_for_serialem(tmp_path):
233242def test_setting_tilt_series_size_and_completion_from_mdoc_parsing (
234243 mock_post , mock_get , tmp_path
235244):
245+ mock_post .post ().status_code = 200
246+
236247 env = MurfeyInstanceEnvironment (
237248 url = urlparse ("http://localhost:8000" ),
238249 client_id = 0 ,
@@ -251,21 +262,21 @@ def test_setting_tilt_series_size_and_completion_from_mdoc_parsing(
251262 assert context ._tilt_series_sizes == {"test_1" : 11 }
252263 (tmp_path / "test_1.mdoc" ).touch ()
253264 tilt = - 50
254- (tmp_path / f"test_1_ [{ tilt :.1f} ]_fractions .tiff" ).touch ()
265+ (tmp_path / f"test_1_001_ [{ tilt :.1f} ]_data_time_fractions .tiff" ).touch ()
255266 context .post_transfer (
256- tmp_path / f"test_1_ [{ tilt :.1f} ]_fractions .tiff" ,
267+ tmp_path / f"test_1_001_ [{ tilt :.1f} ]_data_time_fractions .tiff" ,
257268 role = "detector" ,
258269 environment = env ,
259270 required_strings = ["fractions" ],
260271 )
261272 assert context ._tilt_series == {
262- "test_1" : [tmp_path / f"test_1_ [{ tilt :.1f} ]_fractions .tiff" ]
273+ "test_1" : [tmp_path / f"test_1_001_ [{ tilt :.1f} ]_data_time_fractions .tiff" ]
263274 }
264- for t in range (- 40 , 60 , 10 ):
275+ for i , t in enumerate ( range (- 40 , 60 , 10 ) ):
265276 assert not context ._completed_tilt_series
266- (tmp_path / f"test_1_[{ t :.1f} ]_fractions .tiff" ).touch ()
277+ (tmp_path / f"test_1_{ i :03 } _ [{ t :.1f} ]_data_time_fractions .tiff" ).touch ()
267278 context .post_transfer (
268- tmp_path / f"test_1_[{ t :.1f} ]_fractions .tiff" ,
279+ tmp_path / f"test_1_{ i :03 } _ [{ t :.1f} ]_data_time_fractions .tiff" ,
269280 role = "detector" ,
270281 environment = env ,
271282 required_strings = ["fractions" ],
0 commit comments