Skip to content

Commit

Permalink
Merge pull request #61 from simleo/report_io_not_list
Browse files Browse the repository at this point in the history
report: do not expect input and output to be lists
  • Loading branch information
simleo authored Sep 27, 2023
2 parents 4cb3594 + 78eb36f commit 447de20
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 22 deletions.
4 changes: 2 additions & 2 deletions src/runcrate/report.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def dump_action(action, control_action=None, f=None):
objects = as_list(action.get("object", []))
if objects:
f.write(" inputs:\n")
inputs = set(tool.get("input", []))
inputs = set(as_list(tool.get("input", [])))
for obj in objects:
f.write(f" {obj.get('value', obj.id)}")
for p in as_list(obj.get("exampleOfWork", [])):
Expand All @@ -50,7 +50,7 @@ def dump_action(action, control_action=None, f=None):
results = as_list(action.get("result", []))
if results:
f.write(" outputs:\n")
outputs = set(tool.get("output", []))
outputs = set(as_list(tool.get("output", [])))
for res in results:
f.write(f" {res.get('value', res.id)}")
for p in as_list(res.get("exampleOfWork", [])):
Expand Down
32 changes: 12 additions & 20 deletions tests/data/revsort-provenance-crate-minimal/ro-crate-metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -115,11 +115,9 @@
}
],
"name": "packed.cwl",
"output": [
{
"@id": "packed.cwl#main/output"
}
],
"output": {
"@id": "packed.cwl#main/output"
},
"programmingLanguage": {
"@id": "https://w3id.org/workflowhub/workflow-ro-crate#cwl"
}
Expand Down Expand Up @@ -162,17 +160,13 @@
"@id": "packed.cwl#revtool.cwl",
"@type": "SoftwareApplication",
"description": "Reverse each line using the `rev` command",
"input": [
{
"@id": "packed.cwl#revtool.cwl/input"
}
],
"input": {
"@id": "packed.cwl#revtool.cwl/input"
},
"name": "revtool.cwl",
"output": [
{
"@id": "packed.cwl#revtool.cwl/output"
}
]
"output": {
"@id": "packed.cwl#revtool.cwl/output"
}
},
{
"@id": "packed.cwl#revtool.cwl/input",
Expand All @@ -199,11 +193,9 @@
}
],
"name": "sorttool.cwl",
"output": [
{
"@id": "packed.cwl#sorttool.cwl/output"
}
]
"output": {
"@id": "packed.cwl#sorttool.cwl/output"
}
},
{
"@id": "packed.cwl#sorttool.cwl/reverse",
Expand Down
1 change: 1 addition & 0 deletions tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ def test_cli_report_provenance_minimal(data_dir, caplog):
assert result.exit_code == 0
out_lines = result.stdout.splitlines()
assert sum([_.startswith("action") for _ in out_lines]) == 3
assert sum(["<-" in _ for _ in out_lines]) == 8


def test_cli_version():
Expand Down

0 comments on commit 447de20

Please sign in to comment.