Skip to content

Commit 56410f8

Browse files
author
Dennis Kennetz
committed
try finally failed, using if else instead.
1 parent 2d53247 commit 56410f8

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

tests/test_singularity.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,21 @@
1616

1717
@needs_singularity
1818
def test_singularity_pullfolder(tmp_path):
19-
try:
19+
if "SINGULARITY_PULLFOLDER" in os.environ:
2020
del os.environ["SINGULARITY_PULLFOLDER"]
21-
finally:
21+
workdir = tmp_path / "working_dir_new"
22+
workdir.mkdir()
23+
os.chdir(str(workdir))
24+
pull_folder = tmp_path / "pull_folder"
25+
pull_folder.mkdir()
26+
os.environ["SINGULARITY_PULLFOLDER"] = str(pull_folder)
27+
if "SINGULARITY_PULLFOLDER" in os.environ:
28+
result_code, stdout, stderr = get_main_output(
29+
['--singularity', get_data("tests/sing_pullfolder_test.cwl"), "--message", "hello"])
30+
assert result_code == 0
31+
else:
32+
assert result_code != 0
33+
else:
2234
workdir = tmp_path / "working_dir_new"
2335
workdir.mkdir()
2436
os.chdir(str(workdir))

0 commit comments

Comments
 (0)