diff --git a/lib/galaxy/tool_util/parser/output_models.py b/lib/galaxy/tool_util/parser/output_models.py index 3c190dbecadf..c16d423443a9 100644 --- a/lib/galaxy/tool_util/parser/output_models.py +++ b/lib/galaxy/tool_util/parser/output_models.py @@ -106,7 +106,7 @@ class FilePatternDatasetCollectionDescription(DatasetCollectionDescription): def from_tool_source(tool_source: ToolSource) -> List[ToolOutput]: - tool_outputs, tool_output_collections = tool_source.parse_outputs(object()) + tool_outputs, tool_output_collections = tool_source.parse_outputs(None) outputs = [] for tool_output in tool_outputs.values(): outputs.append(tool_output.to_model()) 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)