Skip to content

Commit 40fc61c

Browse files
authored
Merge pull request #19928 from bernt-matthias/linter-error-test-case-validation
[24.2] Report TestCaseValidation as linter error for 24.2 and above
2 parents 53aa74a + f43486a commit 40fc61c

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

lib/galaxy/tool_util/linters/tests.py

+7-2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
TYPE_CHECKING,
99
)
1010

11+
from packaging.version import Version
12+
1113
from galaxy.tool_util.lint import Linter
1214
from galaxy.tool_util.parameters import validate_test_cases_for_tool_source
1315
from galaxy.tool_util.verify.assertion_models import assertion_list
@@ -166,10 +168,13 @@ def lint(cls, tool_source: "ToolSource", lint_ctx: "LintContext"):
166168
class TestsCaseValidation(Linter):
167169
@classmethod
168170
def lint(cls, tool_source: "ToolSource", lint_ctx: "LintContext"):
171+
profile = tool_source.parse_profile()
172+
lint_log = lint_ctx.warn if Version(profile) < Version("24.2") else lint_ctx.error
173+
169174
try:
170175
validation_results = validate_test_cases_for_tool_source(tool_source, use_latest_profile=True)
171176
except Exception as e:
172-
lint_ctx.warn(
177+
lint_log(
173178
f"Serious problem parsing tool source or tests - cannot validate test cases. The exception is [{e}]",
174179
linter=cls.name(),
175180
)
@@ -178,7 +183,7 @@ def lint(cls, tool_source: "ToolSource", lint_ctx: "LintContext"):
178183
error = validation_result.validation_error
179184
if error:
180185
error_str = _cleanup_pydantic_error(error)
181-
lint_ctx.warn(
186+
lint_log(
182187
f"Test {test_idx}: failed to validate test parameters against inputs - tests won't run on a modern Galaxy tool profile version. Validation errors are [{error_str}]",
183188
linter=cls.name(),
184189
)

0 commit comments

Comments
 (0)