Skip to content

Commit

Permalink
cwl conformance tests: use id field, not label
Browse files Browse the repository at this point in the history
  • Loading branch information
mr-c committed Sep 7, 2023
1 parent 6cd7150 commit 201bc19
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions scripts/cwl_conformance_to_test_cases.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class TestCwlConformance(BaseCwlWorkflowsApiTestCase):

TEST_TEMPLATE = string.Template(
'''
${marks} def test_conformance_${version_simple}_${label}(self):
${marks} def test_conformance_${version_simple}_${id_}(self):
"""${doc}
Generated from::
Expand Down Expand Up @@ -314,9 +314,9 @@ def main():
del test_with_doc["doc"]
cwl_test_def = yaml.dump(test_with_doc, default_flow_style=False)
cwl_test_def = "\n".join(f" {line}" for line in cwl_test_def.splitlines())
label = conformance_test.get("label", str(i))
id_ = conformance_test.get("id", str(i))
tags = conformance_test.get("tags", [])
is_red = label in red_tests_list
is_red = id_ in red_tests_list

marks = " @pytest.mark.cwl_conformance\n"
marks += f" @pytest.mark.cwl_conformance_{version_simple}\n"
Expand All @@ -329,7 +329,7 @@ def main():

if not {"command_line_tool", "expression_tool", "workflow"}.intersection(tags):
print(
f"PROBLEM - test [{label}] tagged with neither command_line_tool, expression_tool, nor workflow",
f"PROBLEM - test [{id_}] tagged with neither command_line_tool, expression_tool, nor workflow",
file=sys.stderr,
)

Expand All @@ -338,17 +338,17 @@ def main():
"version": version,
"doc": conformance_test["doc"],
"cwl_test_def": cwl_test_def,
"label": label.replace("-", "_"),
"id_": id_.replace("-", "_"),
"marks": marks,
}
test_body = TEST_TEMPLATE.safe_substitute(template_kwargs)
tests += test_body

if label in all_tests_found:
print(f"PROBLEM - Duplicate label found [{label}]", file=sys.stderr)
all_tests_found.add(label)
if id_ in all_tests_found:
print(f"PROBLEM - Duplicate id found [{id_}]", file=sys.stderr)
all_tests_found.add(id_)
if is_red:
red_tests_found.add(label)
red_tests_found.add(id_)

test_file_contents = TEST_FILE_TEMPLATE.safe_substitute(
{
Expand Down

0 comments on commit 201bc19

Please sign in to comment.