comparison env/lib/python3.9/site-packages/cwltool/tests/test_parallel.py @ 0:4f3585e2f14b draft default tip

"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
author shellac
date Mon, 22 Mar 2021 18:12:50 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:4f3585e2f14b
1 import json
2 from pathlib import Path
3
4 from cwltool.context import RuntimeContext
5 from cwltool.executors import MultithreadedJobExecutor
6
7 from .util import get_data, get_windows_safe_factory, windows_needs_docker
8
9
10 @windows_needs_docker
11 def test_sequential_workflow(tmp_path: Path) -> None:
12 test_file = "tests/wf/count-lines1-wf.cwl"
13 executor = MultithreadedJobExecutor()
14 runtime_context = RuntimeContext()
15 runtime_context.outdir = str(tmp_path)
16 runtime_context.select_resources = executor.select_resources
17 factory = get_windows_safe_factory(
18 executor=executor, runtime_context=runtime_context
19 )
20 echo = factory.make(get_data(test_file))
21 file_contents = {"class": "File", "location": get_data("tests/wf/whale.txt")}
22 assert echo(file1=file_contents) == {"count_output": 16}
23
24
25 @windows_needs_docker
26 def test_scattered_workflow() -> None:
27 test_file = "tests/wf/scatter-wf4.cwl"
28 job_file = "tests/wf/scatter-job2.json"
29 factory = get_windows_safe_factory(executor=MultithreadedJobExecutor())
30 echo = factory.make(get_data(test_file))
31 with open(get_data(job_file)) as job:
32 assert echo(**json.load(job)) == {"out": ["foo one three", "foo two four"]}