File tree Expand file tree Collapse file tree 1 file changed +21
-1
lines changed Expand file tree Collapse file tree 1 file changed +21
-1
lines changed Original file line number Diff line number Diff line change 11"""Test that all temporary directories respect the --tmpdir-prefix and --tmp-outdir-prefix options."""
2+ import re
23import subprocess
34import sys
45from pathlib import Path
2021from cwltool .utils import create_tmp_dir
2122from ruamel .yaml .comments import CommentedMap
2223
23- from .util import get_data , needs_docker
24+ from .util import get_data , get_main_output , needs_docker
2425
2526
2627def test_docker_commandLineTool_job_tmpdir_prefix (tmp_path : Path ) -> None :
@@ -273,3 +274,22 @@ def test_remove_tmpdirs(tmp_path: Path) -> None:
273274 == 0
274275 )
275276 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