Skip to content

Commit 8ea0fdf

Browse files
committed
better error message for wrong outputSource
1 parent e42b76f commit 8ea0fdf

File tree

3 files changed

+35
-0
lines changed

3 files changed

+35
-0
lines changed

cwltool/checker.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -389,6 +389,11 @@ def check_all_types(
389389
)
390390
else:
391391
parm_id = cast(str, sink[sourceField])
392+
if parm_id not in src_dict:
393+
raise SourceLine(sink, sourceField, ValidationException).makeError(
394+
f"{sourceField} not found: {parm_id}"
395+
)
396+
392397
srcs_of_sink = [src_dict[parm_id]]
393398
linkMerge = None
394399

tests/checker_wf/broken-wf4.cwl

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/usr/bin/env cwl-runner
2+
class: Workflow
3+
cwlVersion: v1.0
4+
inputs:
5+
letters0:
6+
type: string
7+
default: "a0"
8+
9+
outputs:
10+
all:
11+
type: File
12+
outputSource: echo_w
13+
14+
steps:
15+
echo_w:
16+
run: echo.cwl
17+
in:
18+
echo_in: letters0
19+
out: [txt]
20+

tests/test_examples.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1731,3 +1731,13 @@ def test_record_outputeval() -> None:
17311731
== "sha1$da39a3ee5e6b4b0d3255bfef95601890afd80709"
17321732
)
17331733
assert result["annotation_gtf"]["size"] == 0
1734+
1735+
1736+
def tests_outputsource_valid_identifier_invalid_source() -> None:
1737+
"""Confirm error for invalid source that was also a valid identifier."""
1738+
tool_path = get_data("tests/checker_wf/broken-wf4.cwl")
1739+
err_code, stdout, stderr = get_main_output([tool_path])
1740+
assert err_code == 1
1741+
stderr = re.sub(r"\s\s+", " ", stderr)
1742+
assert "tests/checker_wf/broken-wf4.cwl:12:5: outputSource not found" in stderr
1743+
assert "tests/checker_wf/broken-wf4.cwl#echo_w" in stderr

0 commit comments

Comments
 (0)