Skip to content

Commit 7457766

Browse files
authored
Merge pull request #554 from common-workflow-language/fix/#552
Add a default None value for dockerimg variable
2 parents dc621b5 + 08c9913 commit 7457766

File tree

2 files changed

+27
-9
lines changed

2 files changed

+27
-9
lines changed

cwltool/draft2tool.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,8 @@ def job(self,
264264
dockerimg = docker_req.get("dockerImageId") or docker_req.get("dockerPull")
265265
elif kwargs.get("default_container", None) is not None and kwargs.get("use_container"):
266266
dockerimg = kwargs.get("default_container")
267+
else:
268+
dockerimg = None
267269

268270
if dockerimg:
269271
cmdline = ["docker", "run", dockerimg] + cmdline

tests/test_examples.py

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77

88
from io import StringIO
99

10+
from cwltool.utils import onWindows
11+
1012
try:
1113
reload
1214
except:
@@ -530,19 +532,20 @@ def test_print_dot(self):
530532
self.assertEquals(main(["--print-dot", get_data('tests/wf/revsort.cwl')]), 0)
531533

532534

533-
class TestJsConsole(unittest.TestCase):
535+
class TestCmdLine(unittest.TestCase):
534536
def get_main_stderr(self, new_args):
535-
cwltool_base = path.join(path.dirname(path.abspath(__name__)), "cwltool")
536-
537537
process = subprocess.Popen([
538-
sys.executable,
539-
"-m",
540-
"cwltool"
541-
] + new_args, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
538+
sys.executable,
539+
"-m",
540+
"cwltool"
541+
] + new_args, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
542542

543543
stdout, stderr = process.communicate()
544544
return process.returncode, stderr.decode()
545545

546+
547+
class TestJsConsole(TestCmdLine):
548+
546549
def test_js_console_cmd_line_tool(self):
547550
for test_file in ("js_output.cwl", "js_output_workflow.cwl"):
548551
error_code, output = self.get_main_stderr(["--js-console", "--no-container",
@@ -555,11 +558,24 @@ def test_js_console_cmd_line_tool(self):
555558

556559
def test_no_js_console(self):
557560
for test_file in ("js_output.cwl", "js_output_workflow.cwl"):
558-
error_code, output = self.get_main_stderr(["--no-container",
561+
error_code, output = self.get_main_stderr(["--no-container",
559562
get_data("tests/wf/" + test_file)])
560563

561564
self.assertNotIn("[log] Log message", output)
562565
self.assertNotIn("[err] Error message", output)
563-
566+
567+
568+
@pytest.mark.skipif(onWindows(),
569+
reason="Instance of cwltool is used, on Windows it invokes a default docker container"
570+
"which is not supported on AppVeyor")
571+
class TestCache(TestCmdLine):
572+
def test_wf_without_container(self):
573+
test_file = "hello-workflow.cwl"
574+
error_code, output = self.get_main_stderr(["--cachedir", "cache",
575+
get_data("tests/wf/" + test_file), "--usermessage", "hello"])
576+
self.assertIn("completed success", output)
577+
self.assertEquals(error_code, 0)
578+
579+
564580
if __name__ == '__main__':
565581
unittest.main()

0 commit comments

Comments
 (0)