Skip to content

Commit 4c8e609

Browse files
kinowmr-c
andcommitted
Load schemas before calling print_deps
Small modifications to other tests: 1. `baseCommand: true` is invalid CWL, and unrelated to the scandep bugs that are being tested 2. for the content_types test, choose a different URL to avoid "429 Client Error: Too Many Requests for url" Co-authored-by: Michael R. Crusoe <michael.crusoe@gmail.com>
1 parent 5bd0edc commit 4c8e609

File tree

6 files changed

+60
-7
lines changed

6 files changed

+60
-7
lines changed

cwltool/main.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1093,10 +1093,6 @@ def main(
10931093

10941094
loadingContext, workflowobj, uri = fetch_document(uri, loadingContext)
10951095

1096-
if args.print_deps and loadingContext.loader:
1097-
printdeps(workflowobj, loadingContext.loader, stdout, args.relative_deps, uri)
1098-
return 0
1099-
11001096
loadingContext, uri = resolve_and_validate_document(
11011097
loadingContext,
11021098
workflowobj,
@@ -1112,6 +1108,10 @@ def main(
11121108
print(print_pack(loadingContext, uri), file=stdout)
11131109
return 0
11141110

1111+
if args.print_deps:
1112+
printdeps(workflowobj, loadingContext.loader, stdout, args.relative_deps, uri)
1113+
return 0
1114+
11151115
if args.provenance and runtimeContext.research_obj:
11161116
# Can't really be combined with args.pack at same time
11171117
packed_workflow(runtimeContext.research_obj, print_pack(loadingContext, uri))

tests/test_content_type.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ def test_content_types(caplog: LogCaptureFixture) -> None:
77
for _ in ("js_output.cwl", "js_output_workflow.cwl"):
88
commands = [
99
"https://raw.githubusercontent.com/common-workflow-language/common-workflow-language/main/v1.0/v1.0/test-cwl-out2.cwl",
10-
"https://github.com/common-workflow-language/common-workflow-language/blob/main/v1.0/v1.0/empty.json",
10+
"https://www.cnn.com",
1111
]
1212
error_code, _, stderr = get_main_output(commands)
1313

tests/test_examples.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -575,6 +575,27 @@ def test_scandeps_defaults_with_secondaryfiles() -> None:
575575
].endswith(os.path.join("tests", "wf", "indir1"))
576576

577577

578+
def test_issue_1765_print_deps_with_workflows_having_namespace_location_steps() -> None:
579+
"""Test for issue 1765.
580+
581+
An external workflow step passed the validation, but failed to print-deps.
582+
"""
583+
stream = StringIO()
584+
585+
main(
586+
[
587+
"--print-deps",
588+
"--relative-deps=primary",
589+
"--debug",
590+
get_data("tests/wf/print_deps_with_workflows_having_namespace_location_steps.cwl"),
591+
],
592+
stdout=stream,
593+
)
594+
assert json.loads(stream.getvalue())["secondaryFiles"][0]["secondaryFiles"][0][
595+
"location"
596+
].endswith("EDAM_1.18.owl")
597+
598+
578599
def test_dedupe() -> None:
579600
not_deduped: list[CWLObjectType] = [
580601
{"class": "File", "location": "file:///example/a"},
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#!/usr/bin/env cwl-runner
2+
# From:
3+
# - https://github.com/common-workflow-language/cwltool/issues/1765
4+
# - https://github.com/pvanheus/lukasa/blob/99e827e0125cf07621253ae081199298adf7227b/protein_evidence_mapping.cwl
5+
cwlVersion: v1.2
6+
class: Workflow
7+
8+
inputs:
9+
contigs_fasta:
10+
label: "Genomic contigs (FASTA)"
11+
type: File
12+
format: edam:format_1929
13+
outputs:
14+
out:
15+
type: File
16+
outputSource:
17+
samtools_index_contigs/sequences_with_index
18+
19+
steps:
20+
samtools_index_contigs:
21+
# This step is from an external file. print_deps failed here, with a validation
22+
# error message, even though --validate passed.
23+
run: bio-cwl-tools:samtools/samtools_faidx.cwl
24+
in:
25+
sequences: contigs_fasta
26+
out:
27+
- sequences_with_index
28+
$namespaces:
29+
edam: http://edamontology.org/
30+
bio-cwl-tools: https://raw.githubusercontent.com/common-workflow-library/bio-cwl-tools/release/
31+
$schemas:
32+
- http://edamontology.org/EDAM_1.18.owl

tests/wf/trick_defaults.cwl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@ inputs:
1313
class: Directory
1414
location: indir1
1515
outputs: []
16-
baseCommand: true
16+
baseCommand: []

tests/wf/trick_defaults2.cwl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@ inputs:
1111
- class: Directory
1212
location: indir1
1313
outputs: []
14-
baseCommand: true
14+
baseCommand: []

0 commit comments

Comments
 (0)