Skip to content

Commit 0856799

Browse files
author
Dennis Kennetz
committed
added tests to find debian.img in cwd if singularity_pullfolder not in env and to find it in singularity_pullfolder if in env.
1 parent d9a351f commit 0856799

File tree

2 files changed

+37
-0
lines changed

2 files changed

+37
-0
lines changed

tests/sing_pullfolder_test.cwl

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/usr/bin/env cwl-runner
2+
cwlVersion: v1.0
3+
class: CommandLineTool
4+
5+
requirements:
6+
DockerRequirement:
7+
dockerPull: debian
8+
9+
inputs:
10+
message: string
11+
12+
outputs: []
13+
14+
baseCommand: echo

tests/test_singularity.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import sys
2+
import os
23
import pytest
34

45
import distutils.spawn
@@ -38,3 +39,25 @@ def test_singularity_incorrect_image_pull():
3839
['--singularity', '--default-container', 'non-existant-weird-image',
3940
get_data("tests/wf/hello-workflow.cwl"), "--usermessage", "hello"])
4041
assert result_code != 0
42+
43+
@needs_singularity
44+
def test_singularity_local():
45+
result_code, _, stderr = get_main_output(
46+
['--singularity', get_data("tests/sing_pullfolder_test.cwl"), "--message", "hello"])
47+
file_in_dir = os.listdir(os.getcwd())
48+
assert 'debian.img' in file_in_dir
49+
50+
@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(
59+
['--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+

0 commit comments

Comments
 (0)