Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions cwltest/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -470,9 +470,17 @@ def main(): # type: () -> int

for t in tests:
if t.get("label"):
_logger.warning("The `label` field is deprecated. Use `id` field instead.")
t["short_name"] = t["label"]
elif t.get("id") and isinstance(t.get("id"), str):
t["short_name"] = shortname(t["id"])
elif t.get("id"):
if isinstance(t.get("id"), str):
t["short_name"] = shortname(t["id"])
else:
_logger.warning(
"The `id` field with integer is deprecated. Use string identifier instead."
)
else:
_logger.warning("The `id` field is missing.")

if args.show_tags:
alltags = set() # type: Set[str]
Expand Down
5 changes: 5 additions & 0 deletions cwltest/tests/test-data/integer-id.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
- job: v1.0/cat1-job.json
output: {}
tool: return-0.cwl
doc: Test with an integer id
id: 1
3 changes: 3 additions & 0 deletions cwltest/tests/test_categories.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ def test_unsupported_with_required_tests():
else:
q = ""
assert (
"The `id` field is missing.{n}"
"The `id` field is missing.{n}"
"Test [1/2] Required test that is unsupported (without tags){n}"
"{n}"
"Test 1 failed: mock-cwl-runner --quiet return-unsupported.cwl {q}v1.0{p}cat-job.json{q}{n}"
Expand All @@ -57,6 +59,7 @@ def test_unsupported_with_optional_tests():
error_code, stdout, stderr = run_with_mock_cwl_runner(args)
assert error_code == 0
assert (
"The `id` field is missing.{n}"
"Test [1/1] Optional test that is unsupported{n}{n}"
"0 tests passed, 1 unsupported "
"features{n}".format(n=n)
Expand Down
19 changes: 19 additions & 0 deletions cwltest/tests/test_integer_id.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import os
from os import linesep as n
from pathlib import Path

from .util import run_with_mock_cwl_runner, get_data
import defusedxml.ElementTree as ET


def test_warning_with_integer_id():
args = [
"--test",
get_data("tests/test-data/integer-id.yml"),
"-l",
]
error_code, stdout, stderr = run_with_mock_cwl_runner(args)
assert (
"The `id` field with integer is deprecated. Use string identifier instead."
in stderr
)
1 change: 1 addition & 0 deletions cwltest/tests/test_multi_lined_doc.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
def test_run():
args = ["--test", get_data("tests/test-data/multi-lined-doc.yml")]
error_code, stdout, stderr = run_with_mock_cwl_runner(args)
assert "The `label` field is deprecated. Use `id` field instead." in stderr
assert f"Test [1/2] opt-error: Test with label{n}" in stderr
assert f"Test [2/2] Test without label{n}" in stderr

Expand Down