Skip to content

Commit 7871a46

Browse files
authored
Merge pull request #15 from aldbr/test_run_blocking_trans_with_multi_dest_input
test: allow multiple destinations for blocking transformation test
2 parents a8d9fff + 82c6949 commit 7871a46

File tree

1 file changed

+29
-25
lines changed

1 file changed

+29
-25
lines changed

test/test_workflows.py

Lines changed: 29 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -255,47 +255,50 @@ def test_run_nonblocking_transformation_success(
255255

256256

257257
@pytest.mark.parametrize(
258-
"cwl_file, metadata, source_input_data, destination_input_data",
258+
"cwl_file, metadata, destination_source_input_data",
259259
[
260260
# --- Pi example ---
261261
(
262262
"test/workflows/pi/pigather.cwl",
263263
"test/workflows/pi/type_dependencies/transformation/metadata-pi_gather.yaml",
264-
[
265-
"test/workflows/pi/type_dependencies/job/result_1.sim",
266-
"test/workflows/pi/type_dependencies/job/result_2.sim",
267-
"test/workflows/pi/type_dependencies/job/result_3.sim",
268-
"test/workflows/pi/type_dependencies/job/result_4.sim",
269-
"test/workflows/pi/type_dependencies/job/result_5.sim",
270-
],
271-
"filecatalog/pi/100",
264+
{
265+
"filecatalog/pi/100": [
266+
"test/workflows/pi/type_dependencies/job/result_1.sim",
267+
"test/workflows/pi/type_dependencies/job/result_2.sim",
268+
"test/workflows/pi/type_dependencies/job/result_3.sim",
269+
"test/workflows/pi/type_dependencies/job/result_4.sim",
270+
"test/workflows/pi/type_dependencies/job/result_5.sim",
271+
]
272+
},
272273
),
273274
# --- LHCb example ---
274275
(
275276
"test/workflows/lhcb/lhcbreconstruct.cwl",
276277
"test/workflows/lhcb/type_dependencies/transformation/metadata-lhcb_reconstruct.yaml",
277-
[
278-
"test/workflows/lhcb/type_dependencies/job/Gauss_123_456_1.sim",
279-
"test/workflows/lhcb/type_dependencies/job/Gauss_456_456_1.sim",
280-
"test/workflows/lhcb/type_dependencies/job/Gauss_789_456_1.sim",
281-
],
282-
"filecatalog/456/123",
278+
{
279+
"filecatalog/456/123": [
280+
"test/workflows/lhcb/type_dependencies/job/Gauss_123_456_1.sim",
281+
"test/workflows/lhcb/type_dependencies/job/Gauss_456_456_1.sim",
282+
"test/workflows/lhcb/type_dependencies/job/Gauss_789_456_1.sim",
283+
]
284+
},
283285
),
284286
# --- Mandelbrot example ---
285287
(
286288
"test/workflows/mandelbrot/image-merge.cwl",
287289
"test/workflows/mandelbrot/type_dependencies/transformation/metadata-mandelbrot_imagemerge.yaml",
288-
[
289-
"test/workflows/mandelbrot/type_dependencies/transformation/data_1.txt",
290-
"test/workflows/mandelbrot/type_dependencies/transformation/data_2.txt",
291-
"test/workflows/mandelbrot/type_dependencies/transformation/data_3.txt",
292-
],
293-
"filecatalog/mandelbrot/images/raw/1920x1080/",
290+
{
291+
"filecatalog/mandelbrot/images/raw/1920x1080/": [
292+
"test/workflows/mandelbrot/type_dependencies/transformation/data_1.txt",
293+
"test/workflows/mandelbrot/type_dependencies/transformation/data_2.txt",
294+
"test/workflows/mandelbrot/type_dependencies/transformation/data_3.txt",
295+
]
296+
},
294297
),
295298
],
296299
)
297300
def test_run_blocking_transformation_success(
298-
cli_runner, cleanup, cwl_file, metadata, source_input_data, destination_input_data
301+
cli_runner, cleanup, cwl_file, metadata, destination_source_input_data
299302
):
300303
# Define a function to run the transformation command and return the result
301304
def run_transformation():
@@ -322,11 +325,12 @@ def run_and_capture():
322325
transformation_thread.is_alive()
323326
), "The transformation should be waiting for files."
324327

325-
for input in source_input_data:
328+
for destination, inputs in destination_source_input_data.items():
326329
# Copy the input data to the destination
327-
destination = Path(destination_input_data)
330+
destination = Path(destination)
328331
destination.mkdir(parents=True, exist_ok=True)
329-
shutil.copy(input, destination)
332+
for input in inputs:
333+
shutil.copy(input, destination)
330334

331335
# Wait for the thread to finish
332336
transformation_thread.join(timeout=60)

0 commit comments

Comments
 (0)