Skip to content

Commit 0eeb71e

Browse files
committed
Revise assertion relaxation to use better test models.
This was supposed to be part of #19715 but clearly I missed the last mile as always.
1 parent fdafb06 commit 0eeb71e

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

lib/galaxy/tool_util/linters/tests.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212

1313
from galaxy.tool_util.lint import Linter
1414
from galaxy.tool_util.parameters import validate_test_cases_for_tool_source
15-
from galaxy.tool_util.verify.assertion_models import assertion_list
15+
from galaxy.tool_util.verify.assertion_models import assertion_list, relaxed_assertion_list
16+
from galaxy.tool_util.verify.parse import tag_structure_to_that_structure
1617
from galaxy.util import asbool
1718
from ._util import is_datasource
1819

@@ -149,16 +150,16 @@ def lint(cls, tool_source: "ToolSource", lint_ctx: "LintContext"):
149150
return
150151
assert "tests" in raw_tests_dict
151152
# This really only allows coercion from strings, the values themselves will still be validated
152-
strict_validation = tool_source.language != "xml"
153+
assert_list_model = relaxed_assertion_list if tool_source.language == "xml" else assertion_list
153154
for test_idx, test in enumerate(raw_tests_dict["tests"], start=1):
154155
# TODO: validate command, command_version, element tests. What about children?
155156
for output in test["outputs"]:
156157
asserts_raw = output.get("attributes", {}).get("assert_list") or []
157-
to_yaml_assertions = []
158+
processed_assertions = []
158159
for raw_assert in asserts_raw:
159-
to_yaml_assertions.append({"that": raw_assert["tag"], **raw_assert.get("attributes", {})})
160+
processed_assertions.append(tag_structure_to_that_structure(raw_assert))
160161
try:
161-
assertion_list.model_validate(to_yaml_assertions, strict=strict_validation)
162+
assert_list_model.model_validate(processed_assertions)
162163
except Exception as e:
163164
error_str = _cleanup_pydantic_error(e)
164165
lint_ctx.warn(

0 commit comments

Comments
 (0)