Skip to content

Commit 2d53247

Browse files
author
Dennis Kennetz
committed
try to delete os.environ pullfolder if it exists. Then runs env specific code.
1 parent 67cebb0 commit 2d53247

File tree

1 file changed

+15
-12
lines changed

1 file changed

+15
-12
lines changed

tests/test_singularity.py

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,21 @@
1616

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

3235
@needs_singularity
3336
def test_singularity_workflow(tmpdir):

0 commit comments

Comments
 (0)