Skip to content

Commit 554900e

Browse files
author
Anton Khodak
committed
Fail workflows with separate flag without prefix
1 parent 0a48bd0 commit 554900e

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

cwltool/builder.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,9 @@ def generate_arg(self, binding): # type: (Dict[Text,Any]) -> List[Text]
212212

213213
prefix = binding.get("prefix")
214214
sep = binding.get("separate", True)
215+
if prefix is None and not sep:
216+
with SourceLine(binding, "separate", WorkflowException, _logger.isEnabledFor(logging.DEBUG)):
217+
raise WorkflowException("'separate' option can not be specified without prefix")
215218

216219
l = [] # type: List[Dict[Text,Text]]
217220
if isinstance(value, list):
@@ -240,7 +243,7 @@ def generate_arg(self, binding): # type: (Dict[Text,Any]) -> List[Text]
240243
if sep:
241244
args.extend([prefix, self.tostr(j)])
242245
else:
243-
args.append((prefix or "") + self.tostr(j))
246+
args.append(prefix + self.tostr(j))
244247

245248
return [a for a in args if a is not None]
246249

tests/test_examples.py

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

88
from io import StringIO
99

10+
from cwltool.errors import WorkflowException
1011
from cwltool.utils import onWindows
1112

1213
try:
@@ -522,10 +523,11 @@ def test_malformed_outputs(self):
522523
echo()
523524

524525
def test_separate_without_prefix(self):
525-
# check that setting 'separate = false' on an inputBinding without prefix does not fail the workflow
526-
f = cwltool.factory.Factory()
527-
echo = f.make(get_data("tests/wf/separate_without_prefix.cwl"))
528-
self.assertEqual(echo(), {"output": "string\n"})
526+
# check that setting 'separate = false' on an inputBinding without prefix fails the workflow
527+
with self.assertRaises(WorkflowException):
528+
f = cwltool.factory.Factory()
529+
echo = f.make(get_data("tests/wf/separate_without_prefix.cwl"))
530+
echo()
529531

530532

531533
def test_checker(self):

0 commit comments

Comments
 (0)