comparison env/lib/python3.7/site-packages/cwltool/tests/test_iwdr.py @ 2:6af9afd405e9 draft

"planemo upload commit 0a63dd5f4d38a1f6944587f52a8cd79874177fc1"
author shellac
date Thu, 14 May 2020 14:56:58 -0400
parents 26e78fe6e8c4
children
comparison
equal deleted inserted replaced
1:75ca89e9b81c 2:6af9afd405e9
1 import tempfile
2 import os
3 from cwltool.main import main
4 from cwltool import load_tool
5 from .util import (get_data, get_windows_safe_factory, windows_needs_docker,
6 needs_docker, temp_dir, needs_singularity, get_main_output)
7
8 @windows_needs_docker
9 def test_newline_in_entry():
10 """Files in a InitialWorkingDirectory are created with a newline character."""
11 factory = get_windows_safe_factory()
12 echo = factory.make(get_data("tests/wf/iwdr-entry.cwl"))
13 assert echo(message="hello") == {"out": "CONFIGVAR=hello\n"}
14
15
16 @needs_docker
17 def test_empty_file_creation():
18 """An empty file can be created in InitialWorkingDirectory."""
19 err_code, _, _ = get_main_output([get_data("tests/wf/iwdr-empty.cwl")])
20 assert err_code == 0
21
22
23 @needs_docker
24 def test_iwdr_permutations():
25 saved_tempdir = tempfile.tempdir
26 with temp_dir() as misc:
27 tempfile.tempdir = os.path.realpath(misc)
28 with temp_dir() as fifth:
29 with temp_dir() as sixth:
30 with temp_dir() as seventh:
31 with temp_dir() as eighth:
32 with tempfile.NamedTemporaryFile() as first:
33 with tempfile.NamedTemporaryFile() as second:
34 with tempfile.NamedTemporaryFile() as third:
35 with tempfile.NamedTemporaryFile() as fourth:
36 with temp_dir() as outdir:
37 assert(main(
38 ['--outdir', outdir,
39 get_data("tests/wf/iwdr_permutations.cwl"),
40 '--first', first.name,
41 '--second', second.name,
42 '--third', third.name,
43 '--fourth', fourth.name,
44 '--fifth', fifth,
45 '--sixth', sixth,
46 '--seventh', seventh,
47 '--eighth', eighth]) == 0)
48 tempfile.tempdir = saved_tempdir
49
50 @needs_docker
51 def test_iwdr_permutations_inplace():
52 saved_tempdir = tempfile.tempdir
53 with temp_dir() as misc:
54 tempfile.tempdir = os.path.realpath(misc)
55 with temp_dir() as fifth:
56 with temp_dir() as sixth:
57 with temp_dir() as seventh:
58 with temp_dir() as eighth:
59 with tempfile.NamedTemporaryFile() as first:
60 with tempfile.NamedTemporaryFile() as second:
61 with tempfile.NamedTemporaryFile() as third:
62 with tempfile.NamedTemporaryFile() as fourth:
63 with temp_dir() as outdir:
64 assert(main(
65 ['--outdir', outdir,
66 '--enable-ext',
67 '--overrides',
68 get_data("tests/wf/iwdr_permutations_inplace.yml"),
69 get_data("tests/wf/iwdr_permutations.cwl"),
70 '--first', first.name,
71 '--second', second.name,
72 '--third', third.name,
73 '--fourth', fourth.name,
74 '--fifth', fifth,
75 '--sixth', sixth,
76 '--seventh', seventh,
77 '--eighth', eighth]) == 0)
78 tempfile.tempdir = saved_tempdir
79
80 @needs_singularity
81 def test_iwdr_permutations_singularity():
82 with temp_dir() as fifth:
83 with temp_dir() as sixth:
84 with temp_dir() as seventh:
85 with temp_dir() as eighth:
86 with tempfile.NamedTemporaryFile() as first:
87 with tempfile.NamedTemporaryFile() as second:
88 with tempfile.NamedTemporaryFile() as third:
89 with tempfile.NamedTemporaryFile() as fourth:
90 with temp_dir() as outdir:
91 assert(main(
92 ['--outdir', outdir,
93 '--singularity',
94 get_data("tests/wf/iwdr_permutations.cwl"),
95 '--first', first.name,
96 '--second', second.name,
97 '--third', third.name,
98 '--fourth', fourth.name,
99 '--fifth', fifth,
100 '--sixth', sixth,
101 '--seventh', seventh,
102 '--eighth', eighth]) == 0)
103
104 @needs_singularity
105 def test_iwdr_permutations_singularity_inplace():
106 with temp_dir() as fifth:
107 with temp_dir() as sixth:
108 with temp_dir() as seventh:
109 with temp_dir() as eighth:
110 with tempfile.NamedTemporaryFile() as first:
111 with tempfile.NamedTemporaryFile() as second:
112 with tempfile.NamedTemporaryFile() as third:
113 with tempfile.NamedTemporaryFile() as fourth:
114 with temp_dir() as outdir:
115 assert(main(
116 ['--outdir', outdir,
117 '--singularity',
118 '--enable-ext',
119 '--overrides',
120 get_data("tests/wf/iwdr_permutations_inplace.yml"),
121 get_data("tests/wf/iwdr_permutations.cwl"),
122 '--first', first.name,
123 '--second', second.name,
124 '--third', third.name,
125 '--fourth', fourth.name,
126 '--fifth', fifth,
127 '--sixth', sixth,
128 '--seventh', seventh,
129 '--eighth', eighth]) == 0)