Skip to content

Commit

Permalink
Merge pull request #16658 from mr-c/cwl_1.2.1_proposed
Browse files Browse the repository at this point in the history
cwl testing: use the proposed 1.2.1 CWL conformance tests.
  • Loading branch information
nsoranzo committed Sep 7, 2023
2 parents 3db5f56 + 201bc19 commit 29002fe
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 15 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
17 changes: 11 additions & 6 deletions scripts/update_cwl_conformance_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,18 @@ for version in $VERSIONS; do
conformance_filepath=conformance_tests.yaml
tests_dir=tests
fi
wget "https://github.com/common-workflow-language/${repo_name}/archive/main.zip"
unzip main.zip
if [ "$version" = '1.2' ]; then
branch=1.2.1_proposed
else
branch=main
fi
wget "https://github.com/common-workflow-language/${repo_name}/archive/${branch}.zip"
unzip ${branch}.zip
rm -rf "${DEST_DIR}/v${version}"
mkdir -p "${DEST_DIR}/v${version}"
cp "${repo_name}-main/${conformance_filepath}" "${DEST_DIR}/v${version}/conformance_tests.yaml"
cp -r "${repo_name}-main/${tests_dir}" "${DEST_DIR}/v${version}"/
rm -rf "${repo_name}-main"
rm -rf main.zip
cp "${repo_name}-${branch}/${conformance_filepath}" "${DEST_DIR}/v${version}/conformance_tests.yaml"
cp -r "${repo_name}-${branch}/${tests_dir}" "${DEST_DIR}/v${version}"/
rm -rf "${repo_name}-${branch}"
rm -rf ${branch}.zip
python3 scripts/cwl_conformance_to_test_cases.py "${DEST_DIR}" "v${version}"
done

0 comments on commit 29002fe

Please sign in to comment.