mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-24 16:30:27 +08:00
index reload: refresh the entries behind already-registered stubs
_register_new_index_entries_as_stubs skipped every tool already in _tools_by_id, so a stub minted from an install-time ad-hoc entry kept serving that metadata-poor entry after the conf-driven populate enriched the index — the fastp panel payload was missing tool_shed_repository (test_only_latest_version_in_panel_fastp). Swap the entry behind the existing stub instead: the panel and registries hold the stub object, and _overrides survive.
This commit is contained in:
@@ -1052,7 +1052,17 @@ class LazyToolBox(ToolBox):
|
||||
if self._tool_index is None:
|
||||
return
|
||||
for tool_id, entry in self._tool_index.entries.items():
|
||||
if tool_id in self._tools_by_id:
|
||||
# ``Any``: the registry is typed for real Tools but holds
|
||||
# LazyTool stubs on this toolbox (same duck-typing as create_tool).
|
||||
existing: Any = self._tools_by_id.get(tool_id)
|
||||
if existing is not None:
|
||||
if isinstance(existing, LazyTool) and existing._entry is not entry:
|
||||
# Refresh the stub in place — the panel and registries
|
||||
# hold this object, and the reloaded index may carry an
|
||||
# enriched entry (e.g. the conf-driven populate after a
|
||||
# shed install adds repository metadata the install-time
|
||||
# ad-hoc entry lacked). ``_overrides`` survive.
|
||||
existing._entry = entry
|
||||
continue
|
||||
try:
|
||||
self._register_lazy_entry(entry)
|
||||
|
||||
@@ -366,6 +366,18 @@ def test_create_tool_stamps_data_manager_conf_id_on_entry():
|
||||
box._store.update_index_entry.assert_called_once_with(e)
|
||||
|
||||
|
||||
def test_index_reload_refreshes_existing_stub_entries():
|
||||
box = _seam_box()
|
||||
stale = _entry(id="fastp_guid")
|
||||
stub = _stub(stale)
|
||||
box._tools_by_id = {"fastp_guid": stub}
|
||||
enriched = _entry(id="fastp_guid", tool_shed="toolshed.example.com", repository_name="fastp")
|
||||
box._tool_index.entries["fastp_guid"] = enriched
|
||||
box._register_new_index_entries_as_stubs()
|
||||
assert stub._entry is enriched
|
||||
assert stub.to_panel_entry()["tool_shed_repository"]["name"] == "fastp"
|
||||
|
||||
|
||||
def test_create_tool_raises_on_index_miss():
|
||||
# The populator owns the index — including the Galaxy-internal lib
|
||||
# tools listed in ``galaxy.tools.special_tools.hidden_lib_tool_paths``.
|
||||
|
||||
Reference in New Issue
Block a user