diff --git a/lib/galaxy/tool_util/linters/output.py b/lib/galaxy/tool_util/linters/output.py index dc3efbb70c12..37ebab7343d4 100644 --- a/lib/galaxy/tool_util/linters/output.py +++ b/lib/galaxy/tool_util/linters/output.py @@ -86,7 +86,7 @@ def lint(cls, tool_source: "ToolSource", lint_ctx: "LintContext"): for output in tool_xml.findall("./outputs/data") + tool_xml.findall("./outputs/collection"): name = output.attrib.get("name", "") label = output.attrib.get("label", "${tool.name} on ${on_string}") - if label in labels and output.find(".//filter") is not None: + if label in labels and output.find("./filter") is not None: lint_ctx.warn( f"Tool output [{name}] uses duplicated label '{label}', double check if filters imply disjoint cases", linter=cls.name(), @@ -105,7 +105,7 @@ def lint(cls, tool_source: "ToolSource", lint_ctx: "LintContext"): for output in tool_xml.findall("./outputs/data[@name]") + tool_xml.findall("./outputs/collection[@name]"): name = output.attrib.get("name", "") label = output.attrib.get("label", "${tool.name} on ${on_string}") - if label in labels and output.find(".//filter") is None: + if label in labels and output.find("./filter") is None: lint_ctx.warn(f"Tool output [{name}] uses duplicated label '{label}'", linter=cls.name(), node=output) labels.add(label) diff --git a/lib/galaxy/tool_util/linters/tests.py b/lib/galaxy/tool_util/linters/tests.py index cb0cb7f29da7..884518cab684 100644 --- a/lib/galaxy/tool_util/linters/tests.py +++ b/lib/galaxy/tool_util/linters/tests.py @@ -144,11 +144,11 @@ def lint(cls, tool_source: "ToolSource", lint_ctx: "LintContext"): for test_idx, test in enumerate(tests, start=1): # check if expect_num_outputs is set if there are outputs with filters # (except for tests with expect_failure .. which can't have test outputs) - filter = tool_xml.find("./outputs//filter") + has_no_filter = ( + tool_xml.find("./outputs/data/filter") is None and tool_xml.find("./outputs/collection/filter") is None + ) if not ( - filter is None - or "expect_num_outputs" in test.attrib - or asbool(test.attrib.get("expect_failure", False)) + has_no_filter or "expect_num_outputs" in test.attrib or asbool(test.attrib.get("expect_failure", False)) ): lint_ctx.warn( f"Test {test_idx}: should specify 'expect_num_outputs' if outputs have filters",