Skip to content

Commit 5666fbb

Browse files
committed
Add unit test to confirm tmpdir is cleared
1 parent 576fb72 commit 5666fbb

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

tests/test_tmpdir.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
from cwltool.context import LoadingContext, RuntimeContext
1515
from cwltool.docker import DockerCommandLineJob
1616
from cwltool.job import JobBase
17+
from cwltool.main import main
1718
from cwltool.pathmapper import MapperEnt, PathMapper
1819
from cwltool.stdfsaccess import StdFsAccess
1920
from cwltool.update import INTERNAL_VERSION, ORIGINAL_CWLVERSION
@@ -230,3 +231,20 @@ def test_runtimeContext_respects_tmp_outdir_prefix(tmp_path: Path) -> None:
230231
runtime_context = RuntimeContext({"tmp_outdir_prefix": tmpdir_prefix})
231232
assert runtime_context.get_outdir().startswith(tmpdir_prefix)
232233
assert runtime_context.create_outdir().startswith(tmpdir_prefix)
234+
235+
236+
def test_remove_tmpdirs(tmp_path: Path) -> None:
237+
"""Test that the tmpdirs are removed after the job execution."""
238+
assert (
239+
main(
240+
[
241+
"--tmpdir-prefix",
242+
str(f"{tmp_path}/"),
243+
get_data("tests/wf/hello_single_tool.cwl"),
244+
"--message",
245+
"Hello",
246+
]
247+
)
248+
== 0
249+
)
250+
assert len(list(tmp_path.iterdir())) == 0

0 commit comments

Comments
 (0)