comparison env/lib/python3.9/site-packages/cwltool/tests/test_iwdr.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 pathlib import Path
2 from typing import Any
3
4 from cwltool.main import main
5
6 from .util import (
7 get_data,
8 get_main_output,
9 get_windows_safe_factory,
10 needs_docker,
11 needs_singularity,
12 windows_needs_docker,
13 )
14
15
16 @windows_needs_docker
17 def test_newline_in_entry() -> None:
18 """Files in a InitialWorkingDirectory are created with a newline character."""
19 factory = get_windows_safe_factory()
20 echo = factory.make(get_data("tests/wf/iwdr-entry.cwl"))
21 assert echo(message="hello") == {"out": "CONFIGVAR=hello\n"}
22
23
24 @needs_docker
25 def test_empty_file_creation() -> None:
26 """An empty file can be created in InitialWorkingDirectory."""
27 err_code, _, _ = get_main_output([get_data("tests/wf/iwdr-empty.cwl")])
28 assert err_code == 0
29
30
31 @needs_docker
32 def test_directory_literal_with_real_inputs_inside(tmp_path: Path) -> None:
33 """Cope with unmoveable files in the output directory created by Docker+IWDR."""
34 err_code, _, _ = get_main_output(
35 [
36 "--out",
37 str(tmp_path),
38 get_data("tests/iwdr_dir_literal_real_file.cwl"),
39 "--example={}".format(get_data("tests/__init__.py")),
40 ]
41 )
42 assert err_code == 0
43
44
45 @needs_docker
46 def test_iwdr_permutations(tmp_path_factory: Any) -> None:
47 misc = tmp_path_factory.mktemp("misc")
48 fifth = str(tmp_path_factory.mktemp("fifth"))
49 sixth = str(tmp_path_factory.mktemp("sixth"))
50 seventh = str(tmp_path_factory.mktemp("seventh"))
51 eighth = str(tmp_path_factory.mktemp("eighth"))
52 first = misc / "first"
53 first.touch()
54 second = misc / "second"
55 second.touch()
56 third = misc / "third"
57 third.touch()
58 fourth = misc / "fourth"
59 fourth.touch()
60 outdir = str(tmp_path_factory.mktemp("outdir"))
61 assert (
62 main(
63 [
64 "--outdir",
65 outdir,
66 "--enable-dev",
67 get_data("tests/wf/iwdr_permutations.cwl"),
68 "--first",
69 str(first),
70 "--second",
71 str(second),
72 "--third",
73 str(third),
74 "--fourth",
75 str(fourth),
76 "--fifth",
77 fifth,
78 "--sixth",
79 sixth,
80 "--seventh",
81 seventh,
82 "--eighth",
83 eighth,
84 ]
85 )
86 == 0
87 )
88
89
90 @needs_docker
91 def test_iwdr_permutations_inplace(tmp_path_factory: Any) -> None:
92 misc = tmp_path_factory.mktemp("misc")
93 fifth = str(tmp_path_factory.mktemp("fifth"))
94 sixth = str(tmp_path_factory.mktemp("sixth"))
95 seventh = str(tmp_path_factory.mktemp("seventh"))
96 eighth = str(tmp_path_factory.mktemp("eighth"))
97 first = misc / "first"
98 first.touch()
99 second = misc / "second"
100 second.touch()
101 third = misc / "third"
102 third.touch()
103 fourth = misc / "fourth"
104 fourth.touch()
105 outdir = str(tmp_path_factory.mktemp("outdir"))
106 assert (
107 main(
108 [
109 "--outdir",
110 outdir,
111 "--enable-ext",
112 "--enable-dev",
113 "--overrides",
114 get_data("tests/wf/iwdr_permutations_inplace.yml"),
115 get_data("tests/wf/iwdr_permutations.cwl"),
116 "--first",
117 str(first),
118 "--second",
119 str(second),
120 "--third",
121 str(third),
122 "--fourth",
123 str(fourth),
124 "--fifth",
125 fifth,
126 "--sixth",
127 sixth,
128 "--seventh",
129 seventh,
130 "--eighth",
131 eighth,
132 ]
133 )
134 == 0
135 )
136
137
138 @needs_singularity
139 def test_iwdr_permutations_singularity(tmp_path_factory: Any) -> None:
140 misc = tmp_path_factory.mktemp("misc")
141 fifth = str(tmp_path_factory.mktemp("fifth"))
142 sixth = str(tmp_path_factory.mktemp("sixth"))
143 seventh = str(tmp_path_factory.mktemp("seventh"))
144 eighth = str(tmp_path_factory.mktemp("eighth"))
145 first = misc / "first"
146 first.touch()
147 second = misc / "second"
148 second.touch()
149 third = misc / "third"
150 third.touch()
151 fourth = misc / "fourth"
152 fourth.touch()
153 outdir = str(tmp_path_factory.mktemp("outdir"))
154 assert (
155 main(
156 [
157 "--outdir",
158 outdir,
159 "--enable-dev",
160 "--singularity",
161 get_data("tests/wf/iwdr_permutations.cwl"),
162 "--first",
163 str(first),
164 "--second",
165 str(second),
166 "--third",
167 str(third),
168 "--fourth",
169 str(fourth),
170 "--fifth",
171 fifth,
172 "--sixth",
173 sixth,
174 "--seventh",
175 seventh,
176 "--eighth",
177 eighth,
178 ]
179 )
180 == 0
181 )
182
183
184 @needs_singularity
185 def test_iwdr_permutations_singularity_inplace(tmp_path_factory: Any) -> None:
186 misc = tmp_path_factory.mktemp("misc")
187 fifth = str(tmp_path_factory.mktemp("fifth"))
188 sixth = str(tmp_path_factory.mktemp("sixth"))
189 seventh = str(tmp_path_factory.mktemp("seventh"))
190 eighth = str(tmp_path_factory.mktemp("eighth"))
191 first = misc / "first"
192 first.touch()
193 second = misc / "second"
194 second.touch()
195 third = misc / "third"
196 third.touch()
197 fourth = misc / "fourth"
198 fourth.touch()
199 outdir = str(tmp_path_factory.mktemp("outdir"))
200 assert (
201 main(
202 [
203 "--outdir",
204 outdir,
205 "--singularity",
206 "--enable-ext",
207 "--enable-dev",
208 "--overrides",
209 get_data("tests/wf/iwdr_permutations_inplace.yml"),
210 get_data("tests/wf/iwdr_permutations.cwl"),
211 "--first",
212 str(first),
213 "--second",
214 str(second),
215 "--third",
216 str(third),
217 "--fourth",
218 str(fourth),
219 "--fifth",
220 fifth,
221 "--sixth",
222 sixth,
223 "--seventh",
224 seventh,
225 "--eighth",
226 eighth,
227 ]
228 )
229 == 0
230 )