cwl conformance tests: use id field, not label

This commit is contained in:
Michael R. Crusoe
2023-09-07 13:14:03 +02:00
parent 6cd71508e1
commit 201bc19575
+9 -9
View File
@@ -23,7 +23,7 @@ $tests'''
TEST_TEMPLATE = string.Template(
'''
${marks} def test_conformance_${version_simple}_${label}(self):
${marks} def test_conformance_${version_simple}_${id_}(self):
"""${doc}
Generated from::
@@ -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"
@@ -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,
)
@@ -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(
{