From 1158fa6d460721d0c1220c95e06caad629d8d816 Mon Sep 17 00:00:00 2001 From: John Chilton Date: Sat, 3 Aug 2024 12:24:06 -0400 Subject: [PATCH] Fix #18554. --- lib/galaxy/tool_util/parser/xml.py | 9 +++++++-- test/unit/tool_util/test_output_models.py | 9 +++++++++ 2 files changed, 16 insertions(+), 2 deletions(-) create mode 100644 test/unit/tool_util/test_output_models.py diff --git a/lib/galaxy/tool_util/parser/xml.py b/lib/galaxy/tool_util/parser/xml.py index 04c28a8297c6..598d5714213e 100644 --- a/lib/galaxy/tool_util/parser/xml.py +++ b/lib/galaxy/tool_util/parser/xml.py @@ -423,7 +423,7 @@ def parse_provided_metadata_file(self): return provided_metadata_file - def parse_outputs(self, tool): + def parse_outputs(self, tool=None): out_elem = self.root.find("outputs") outputs = {} output_collections = {} @@ -558,7 +558,12 @@ def _parse_output( # This ensures that old tools continue to work. output.from_work_dir = output.from_work_dir.strip() output.hidden = string_as_bool(data_elem.get("hidden", "")) - output.actions = ToolOutputActionGroup(output, data_elem.find("actions")) + if tool is not None: + # poor design here driven entirely by pragmatism in refactoring, ToolOutputActionGroup + # belongs in galaxy-tool because it uses app heavily. Breaking the output objects + # into app-aware things and dumb models would be a large project but superior design + # and decomposition. + output.actions = ToolOutputActionGroup(output, data_elem.find("actions")) output.dataset_collector_descriptions = dataset_collector_descriptions_from_elem( data_elem, legacy=self.legacy_defaults ) diff --git a/test/unit/tool_util/test_output_models.py b/test/unit/tool_util/test_output_models.py new file mode 100644 index 000000000000..4f5c9269c19e --- /dev/null +++ b/test/unit/tool_util/test_output_models.py @@ -0,0 +1,9 @@ +from galaxy.tool_util.parser.factory import get_tool_source +from galaxy.tool_util.parser.output_models import from_tool_source +from galaxy.tool_util.unittest_utils import functional_test_tool_path + + +def test_from_tool_data_table(): + tool_source = get_tool_source(functional_test_tool_path("dbkey_output_action.xml")) + # prevent regression of https://github.com/galaxyproject/galaxy/issues/18554. Tool fails without fix + from_tool_source(tool_source)