Skip to content

Commit 85003b1

Browse files
committed
Merge remote-tracking branch 'origin/master' into draft-4-pa
2 parents 2231714 + baf9e75 commit 85003b1

File tree

3 files changed

+36
-1
lines changed

3 files changed

+36
-1
lines changed

cwltool/main.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,8 +288,13 @@ def generate_parser(toolparser, tool, namemap):
288288
_logger.debug(u"Can't make command line argument from %s", inptype)
289289
return None
290290

291+
if inptype != "boolean":
292+
typekw = { 'type': atype }
293+
else:
294+
typekw = {}
295+
291296
toolparser.add_argument(flag + name, required=required,
292-
help=ahelp, action=action, type=atype, default=default)
297+
help=ahelp, action=action, default=default, **typekw)
293298

294299
return toolparser
295300

cwltool/workflow.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,8 @@ def are_same_type(src, sink): # type: (Any, Any) -> bool
9393
"""
9494
if isinstance(src, dict) and isinstance(sink, dict):
9595
if src["type"] == "array" and sink["type"] == "array":
96+
if 'null' in sink["items"]:
97+
return are_same_type([src["items"]], [it for it in sink["items"] if it != 'null'])
9698
return are_same_type(src["items"], sink["items"])
9799
elif src["type"] == sink["type"]:
98100
return True

tests/test_toolargparse.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,38 @@ class ToolArgparse(unittest.TestCase):
2424
glob: test.txt
2525
stdout: test.txt
2626
baseCommand: [cat]
27+
'''
28+
29+
script2='''
30+
#!/usr/bin/env cwl-runner
31+
cwlVersion: 'cwl:draft-3'
32+
class: CommandLineTool
33+
inputs:
34+
- id: bdg
35+
type: "boolean"
36+
outputs:
37+
- id: output
38+
type: File
39+
outputBinding:
40+
glob: foo
41+
baseCommand:
42+
- echo
43+
- "ff"
44+
stdout: foo
2745
'''
2846

2947
def test_help(self):
3048
with NamedTemporaryFile() as f:
3149
f.write(self.script)
3250
f.flush()
3351
self.assertEquals(main(["--debug", f.name, '--input', 'README.rst']), 0)
52+
self.assertEquals(main(["--debug", f.name, '--input', 'README.rst']), 0)
53+
54+
def test_bool(self):
55+
with NamedTemporaryFile() as f:
56+
f.write(self.script2)
57+
f.flush()
58+
try:
59+
self.assertEquals(main([f.name, '--help']), 0)
60+
except SystemExit as e:
61+
self.assertEquals(e.code, 0)

0 commit comments

Comments
 (0)