Skip to content

Commit 02f4d36

Browse files
test: allow multiple destinations for blocking transformation test
1 parent a8d9fff commit 02f4d36

File tree

1 file changed

+71
-25
lines changed

1 file changed

+71
-25
lines changed

test/test_workflows.py

Lines changed: 71 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -254,48 +254,93 @@ def test_run_nonblocking_transformation_success(
254254
), f"Failed to run the transformation: {result.stdout}"
255255

256256

257+
# @pytest.mark.parametrize(
258+
# "cwl_file, metadata, source_input_data, destination_input_data",
259+
# [
260+
# # --- Pi example ---
261+
# (
262+
# "test/workflows/pi/pigather.cwl",
263+
# "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",
272+
# ),
273+
# # --- LHCb example ---
274+
# (
275+
# "test/workflows/lhcb/lhcbreconstruct.cwl",
276+
# "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",
283+
# ),
284+
# # --- Mandelbrot example ---
285+
# (
286+
# "test/workflows/mandelbrot/image-merge.cwl",
287+
# "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/",
294+
# ),
295+
# ],
296+
# )
297+
298+
257299
@pytest.mark.parametrize(
258-
"cwl_file, metadata, source_input_data, destination_input_data",
300+
"cwl_file, metadata, destination_source_input_data",
259301
[
260302
# --- Pi example ---
261303
(
262304
"test/workflows/pi/pigather.cwl",
263305
"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",
306+
{
307+
"filecatalog/pi/100": [
308+
"test/workflows/pi/type_dependencies/job/result_1.sim",
309+
"test/workflows/pi/type_dependencies/job/result_2.sim",
310+
"test/workflows/pi/type_dependencies/job/result_3.sim",
311+
"test/workflows/pi/type_dependencies/job/result_4.sim",
312+
"test/workflows/pi/type_dependencies/job/result_5.sim",
313+
]
314+
},
272315
),
273316
# --- LHCb example ---
274317
(
275318
"test/workflows/lhcb/lhcbreconstruct.cwl",
276319
"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",
320+
{
321+
"filecatalog/456/123": [
322+
"test/workflows/lhcb/type_dependencies/job/Gauss_123_456_1.sim",
323+
"test/workflows/lhcb/type_dependencies/job/Gauss_456_456_1.sim",
324+
"test/workflows/lhcb/type_dependencies/job/Gauss_789_456_1.sim",
325+
]
326+
},
283327
),
284328
# --- Mandelbrot example ---
285329
(
286330
"test/workflows/mandelbrot/image-merge.cwl",
287331
"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/",
332+
{
333+
"filecatalog/mandelbrot/images/raw/1920x1080/": [
334+
"test/workflows/mandelbrot/type_dependencies/transformation/data_1.txt",
335+
"test/workflows/mandelbrot/type_dependencies/transformation/data_2.txt",
336+
"test/workflows/mandelbrot/type_dependencies/transformation/data_3.txt",
337+
]
338+
},
294339
),
295340
],
296341
)
297342
def test_run_blocking_transformation_success(
298-
cli_runner, cleanup, cwl_file, metadata, source_input_data, destination_input_data
343+
cli_runner, cleanup, cwl_file, metadata, destination_source_input_data
299344
):
300345
# Define a function to run the transformation command and return the result
301346
def run_transformation():
@@ -322,11 +367,12 @@ def run_and_capture():
322367
transformation_thread.is_alive()
323368
), "The transformation should be waiting for files."
324369

325-
for input in source_input_data:
370+
for destination, inputs in destination_source_input_data.items():
326371
# Copy the input data to the destination
327-
destination = Path(destination_input_data)
372+
destination = Path(destination)
328373
destination.mkdir(parents=True, exist_ok=True)
329-
shutil.copy(input, destination)
374+
for input in inputs:
375+
shutil.copy(input, destination)
330376

331377
# Wait for the thread to finish
332378
transformation_thread.join(timeout=60)

0 commit comments

Comments
 (0)