Skip to content

Commit 8bad597

Browse files
author
Dennis Kennetz
committed
Added conditional to test to increase code coverage, these were missed with current tests.
1 parent 5118697 commit 8bad597

File tree

1 file changed

+19
-4
lines changed

1 file changed

+19
-4
lines changed

tests/test_singularity.py

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,17 @@ def test_singularity_iwdr():
3333
else:
3434
assert result_code != 0
3535

36+
def test_singularity_pullfolder_in_env():
37+
os.environ["SINGULARITY_PULLFOLDER"] = str(os.getcwd())
38+
os.environ["SINGULARITY_CACHEDIR"] = str(os.getcwd())
39+
result_code = main(
40+
['--singularity', '--default-container', 'debian',
41+
get_data("tests/wf/iwdr-entry.cwl"), "--message", "hello"])
42+
for env in ("SINGULARITY_PULLFOLDER", "SINGULARITY_CACHEDIR"):
43+
if env in os.environ:
44+
assert result_code == 0
45+
else:
46+
assert result_code != 0
3647
@needs_singularity
3748
def test_singularity_incorrect_image_pull():
3849
result_code, _, stderr = get_main_output(
@@ -58,7 +69,11 @@ def test_singularity_pullfolder(tmp_path):
5869
pull_folder = tmp_path / "pull_folder"
5970
pull_folder.mkdir()
6071
os.environ["SINGULARITY_PULLFOLDER"] = str(pull_folder)
61-
result_code, stdout, stderr = get_main_output(
62-
['--singularity', get_data("tests/sing_pullfolder_test.cwl"), "--message", "hello"])
63-
file_in_dir = os.listdir(str(pull_folder))
64-
assert 'debian.img' in file_in_dir, stderr
72+
if "SINGULARITY_PULLFOLDER" in os.environ:
73+
result_code, stdout, stderr = get_main_output(
74+
['--singularity', get_data("tests/sing_pullfolder_test.cwl"), "--message", "hello"])
75+
file_in_dir = os.listdir(str(pull_folder))
76+
assert 'debian.img' in file_in_dir, stderr
77+
else:
78+
asset result_code != 0
79+

0 commit comments

Comments
 (0)