Skip to content

Commit 5574b66

Browse files
committed
test --leave-tmpdir
1 parent e79d1a0 commit 5574b66

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

tests/test_tmpdir.py

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Test that all temporary directories respect the --tmpdir-prefix and --tmp-outdir-prefix options."""
2+
import re
23
import subprocess
34
import sys
45
from pathlib import Path
@@ -20,7 +21,7 @@
2021
from cwltool.utils import create_tmp_dir
2122
from 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

2627
def test_docker_commandLineTool_job_tmpdir_prefix(tmp_path: Path) -> None:
@@ -273,3 +274,20 @@ 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}/"),
286+
"--leave-tmpdir",
287+
get_data("tests/env4.cwl"),
288+
]
289+
)
290+
assert error_code == 0
291+
assert re.search(rf"\"{re.escape(str(tmp_path))}/.*/env0\.py\"", stderr)
292+
assert len(list(tmp_path.iterdir())) == 3
293+
assert len(list(tmp_path.glob("**/env0.py"))) == 1

0 commit comments

Comments
 (0)