File tree 1 file changed +21
-1
lines changed
1 file changed +21
-1
lines changed Original file line number Diff line number Diff line change 1
1
"""Test that all temporary directories respect the --tmpdir-prefix and --tmp-outdir-prefix options."""
2
+ import re
2
3
import subprocess
3
4
import sys
4
5
from pathlib import Path
20
21
from cwltool .utils import create_tmp_dir
21
22
from ruamel .yaml .comments import CommentedMap
22
23
23
- from .util import get_data , needs_docker
24
+ from .util import get_data , get_main_output , needs_docker
24
25
25
26
26
27
def test_docker_commandLineTool_job_tmpdir_prefix (tmp_path : Path ) -> None :
@@ -273,3 +274,22 @@ def test_remove_tmpdirs(tmp_path: Path) -> None:
273
274
== 0
274
275
)
275
276
assert len (list (tmp_path .iterdir ())) == 0
277
+
278
+
279
+ def test_leave_tmpdirs (tmp_path : Path ) -> None :
280
+ """Test that the tmpdirs including input staging directories are retained after the job execution."""
281
+ error_code , stdout , stderr = get_main_output (
282
+ [
283
+ "--debug" ,
284
+ "--tmpdir-prefix" ,
285
+ str (f"{ tmp_path } /tmp/" ),
286
+ "--leave-tmpdir" ,
287
+ "--outdir" ,
288
+ str (f"{ tmp_path } /out/" ),
289
+ get_data ("tests/env4.cwl" ),
290
+ ]
291
+ )
292
+ assert error_code == 0
293
+ assert re .search (rf"\" { re .escape (str (tmp_path ))} /tmp/.*/env0\.py\"" , stderr )
294
+ assert len (list ((tmp_path / "tmp" ).iterdir ())) == 3
295
+ assert len (list ((tmp_path / "tmp" ).glob ("**/env0.py" ))) == 1
You can’t perform that action at this time.
0 commit comments