|
1 | 1 | import sys
|
| 2 | +import copy |
2 | 3 | import os
|
3 | 4 | import pytest
|
4 | 5 |
|
|
16 | 17 |
|
17 | 18 | @needs_singularity
|
18 | 19 | def test_singularity_pullfolder(tmp_path):
|
19 |
| - |
20 |
| - if "SINGULARITY_PULLFOLDER" in os.environ: |
21 |
| - del os.environ["SINGULARITY_PULLFOLDER"] |
22 |
| - workdir = tmp_path / "working_dir_new" |
23 |
| - workdir.mkdir() |
24 |
| - os.chdir(str(workdir)) |
25 |
| - pullfolder = tmp_path / "pull_folder" |
26 |
| - pullfolder.mkdir() |
27 |
| - os.environ["SINGULARITY_PULLFOLDER"] = str(pullfolder) |
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 |
34 |
| - else: |
35 |
| - workdir = tmp_path / "working_dir_new" |
36 |
| - workdir.mkdir() |
37 |
| - os.chdir(str(workdir)) |
38 |
| - pullfolder = tmp_path / "pullfolder" |
39 |
| - pullfolder.mkdir() |
40 |
| - os.environ["SINGULARITY_PULLFOLDER"] = str(pullfolder) |
41 |
| - if "SINGULARITY_PULLFOLDER" in os.environ: |
42 |
| - result_code, stdout, stderr = get_main_output( |
43 |
| - ['--singularity', get_data("tests/sing_pullfolder_test.cwl"), "--message", "hello"]) |
44 |
| - assert result_code == 0 |
45 |
| - else: |
46 |
| - assert result_code != 0 |
| 20 | + workdir = tmp_path / "working_dir_new" |
| 21 | + workdir.mkdir() |
| 22 | + os.chdir(str(workdir)) |
| 23 | + pullfolder = tmp_path / "pullfolder" |
| 24 | + pullfolder.mkdir() |
| 25 | + env = copy.deepcopy(os.environ) |
| 26 | + env["SINGULARITY_PULLFOLDER"] = str(pullfolder) |
| 27 | + result_code, stdout, stderr = get_main_output( |
| 28 | + ['--singularity', get_data("tests/sing_pullfolder_test.cwl"), "--message", "hello"], env=env) |
| 29 | + assert result_code == 0 |
| 30 | + # TODO, confirm that the image is in the pullfolder |
47 | 31 |
|
48 | 32 | @needs_singularity
|
49 | 33 | def test_singularity_workflow(tmpdir):
|
|
0 commit comments