Skip to content

Commit fac18d9

Browse files
committed
make test more flexible
1 parent 9eab54b commit fac18d9

File tree

1 file changed

+10
-12
lines changed

1 file changed

+10
-12
lines changed

tests/test_singularity.py

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -48,16 +48,14 @@ def test_singularity_local():
4848
assert 'debian.img' in file_in_dir
4949

5050
@needs_singularity
51-
def test_singularity_pullfolder():
52-
filepath = str(os.getcwd())
53-
tmp = '/tmp/'
54-
pull_folder = filepath+tmp
55-
if not os.path.exists(pull_folder):
56-
os.makedirs(pull_folder)
57-
os.environ["SINGULARITY_PULLFOLDER"] = pull_folder
58-
result_code, _, stderr = get_main_output(
51+
def test_singularity_pullfolder(tmp_path):
52+
workdir = tmp_path / "working_dir"
53+
workdir.mkdir()
54+
os.chdir(str(workdir))
55+
pull_folder = tmp_path / "pull_folder"
56+
pull_folder.mkdir()
57+
os.environ["SINGULARITY_PULLFOLDER"] = str(pull_folder)
58+
result_code, stdout, stderr = get_main_output(
5959
['--singularity', get_data("tests/sing_pullfolder_test.cwl"), "--message", "hello"])
60-
file_in_dir = os.listdir(pull_folder)
61-
assert 'debian.img' in file_in_dir
62-
63-
60+
file_in_dir = os.listdir(str(pull_folder))
61+
assert 'debian.img' in file_in_dir, stderr

0 commit comments

Comments
 (0)