From ab142bf9c510d03bda004a88fc870336c2d09c88 Mon Sep 17 00:00:00 2001 From: John Chilton Date: Thu, 5 Nov 2020 11:59:19 -0500 Subject: [PATCH] Rebase into handling multiple versions. --- lib/galaxy/tools/toolbox/base.py | 10 +++++++--- lib/galaxy_test/api/test_tools.py | 2 ++ 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/lib/galaxy/tools/toolbox/base.py b/lib/galaxy/tools/toolbox/base.py index 8f6f6b0ad88..fd8a4740025 100644 --- a/lib/galaxy/tools/toolbox/base.py +++ b/lib/galaxy/tools/toolbox/base.py @@ -519,9 +519,13 @@ class AbstractToolBox(Dictifiable, ManagesIntegratedToolPanelMixin): rval.append(lineage_tool) if not rval: # still no tool, do a deeper search and try to match by old ids - for tool in self._tools_by_id.values(): - if tool.old_id == tool_id: - rval.append(tool) + if get_all_versions and tool_id in self._tool_versions_by_id: + rval.extend(self._tool_versions_by_id[tool_id].values()) + else: + for tool in self._tools_by_id.values(): + if tool.old_id == tool_id: + rval.append(tool) + # if we don't have a lineage_map for this tool we need to sort by version, # so that the last tool in rval is the newest tool. rval.sort(key=lambda t: t.version) diff --git a/lib/galaxy_test/api/test_tools.py b/lib/galaxy_test/api/test_tools.py index 05b81cf554a..b322822a9ef 100644 --- a/lib/galaxy_test/api/test_tools.py +++ b/lib/galaxy_test/api/test_tools.py @@ -690,11 +690,13 @@ class ToolsTestCase(ApiTestCase, TestsTools): @uses_test_history(require_new=False) def test_test_by_versions(self, history_id): test_data_response = self._get("tools/%s/test_data" % "multiple_versions") + test_data_response.raise_for_status() test_data_dicts = test_data_response.json() assert len(test_data_dicts) == 1 assert test_data_dicts[0]["tool_version"] == "0.2" test_data_response = self._get("tools/%s/test_data?tool_version=*" % "multiple_versions") + test_data_response.raise_for_status() test_data_dicts = test_data_response.json() assert len(test_data_dicts) == 2