Mercurial > repos > shellac > sam_consensus_v3
comparison env/lib/python3.9/site-packages/cwltool/tests/test_docker.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 from distutils import spawn | |
2 from pathlib import Path | |
3 | |
4 from cwltool.main import main | |
5 | |
6 from .util import get_data, get_main_output, needs_docker | |
7 | |
8 | |
9 @needs_docker | |
10 def test_docker_workflow(tmp_path: Path) -> None: | |
11 """Basic test for docker with a CWL Workflow.""" | |
12 result_code, _, stderr = get_main_output( | |
13 [ | |
14 "--default-container", | |
15 "debian", | |
16 "--outdir", | |
17 str(tmp_path), | |
18 get_data("tests/wf/hello-workflow.cwl"), | |
19 "--usermessage", | |
20 "hello", | |
21 ] | |
22 ) | |
23 assert "completed success" in stderr | |
24 assert (tmp_path / "response.txt").read_text("utf-8") == "hello" | |
25 assert result_code == 0 | |
26 | |
27 | |
28 def test_docker_iwdr() -> None: | |
29 result_code = main( | |
30 [ | |
31 "--default-container", | |
32 "debian", | |
33 get_data("tests/wf/iwdr-entry.cwl"), | |
34 "--message", | |
35 "hello", | |
36 ] | |
37 ) | |
38 docker_installed = bool(spawn.find_executable("docker")) | |
39 if docker_installed: | |
40 assert result_code == 0 | |
41 else: | |
42 assert result_code != 0 | |
43 | |
44 | |
45 @needs_docker | |
46 def test_docker_incorrect_image_pull() -> None: | |
47 result_code = main( | |
48 [ | |
49 "--default-container", | |
50 "non-existant-weird-image", | |
51 get_data("tests/wf/hello-workflow.cwl"), | |
52 "--usermessage", | |
53 "hello", | |
54 ] | |
55 ) | |
56 assert result_code != 0 | |
57 | |
58 | |
59 @needs_docker | |
60 def test_docker_file_mount() -> None: | |
61 # test for bug in | |
62 # ContainerCommandLineJob.create_file_and_add_volume() | |
63 # | |
64 # the bug was that it would use the file literal contents as the | |
65 # temporary file name, which can easily result in a file name that | |
66 # is too long or otherwise invalid. This test case uses ".." | |
67 result_code = main( | |
68 [get_data("tests/wf/literalfile.cwl"), get_data("tests/wf/literalfile-job.yml")] | |
69 ) | |
70 assert result_code == 0 |