Skip to content

Commit

Permalink
better error message for wrong outputSource
Browse files Browse the repository at this point in the history
  • Loading branch information
mr-c committed Feb 20, 2022
1 parent e42b76f commit 8ea0fdf
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 0 deletions.
5 changes: 5 additions & 0 deletions cwltool/checker.py
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,11 @@ def check_all_types(
)
else:
parm_id = cast(str, sink[sourceField])
if parm_id not in src_dict:
raise SourceLine(sink, sourceField, ValidationException).makeError(
f"{sourceField} not found: {parm_id}"
)

srcs_of_sink = [src_dict[parm_id]]
linkMerge = None

Expand Down
20 changes: 20 additions & 0 deletions tests/checker_wf/broken-wf4.cwl
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/usr/bin/env cwl-runner
class: Workflow
cwlVersion: v1.0
inputs:
letters0:
type: string
default: "a0"

outputs:
all:
type: File
outputSource: echo_w

steps:
echo_w:
run: echo.cwl
in:
echo_in: letters0
out: [txt]

10 changes: 10 additions & 0 deletions tests/test_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -1731,3 +1731,13 @@ def test_record_outputeval() -> None:
== "sha1$da39a3ee5e6b4b0d3255bfef95601890afd80709"
)
assert result["annotation_gtf"]["size"] == 0


def tests_outputsource_valid_identifier_invalid_source() -> None:
"""Confirm error for invalid source that was also a valid identifier."""
tool_path = get_data("tests/checker_wf/broken-wf4.cwl")
err_code, stdout, stderr = get_main_output([tool_path])
assert err_code == 1
stderr = re.sub(r"\s\s+", " ", stderr)
assert "tests/checker_wf/broken-wf4.cwl:12:5: outputSource not found" in stderr
assert "tests/checker_wf/broken-wf4.cwl#echo_w" in stderr

0 comments on commit 8ea0fdf

Please sign in to comment.