Skip to content

Commit 07c5d44

Browse files
committed
Ensure tool_data_path exists; assert non-DM skip via persisted XML
install_tool_data_tables used to create tool_data_path as a side effect of os.makedirs(target_dir); skipping it for non-DM repos means copy_sample_files now blows up with FileNotFoundError. Explicitly mkdir(exist_ok=True) before copying. The non-DM integration test was asserting against the in-memory tool_data_tables dict, which is populated as tools are loaded regardless of registration; switch to verify_no_installed_repository_data_table_entries, which inspects shed_tool_data_table_conf.xml.
1 parent a5deee5 commit 07c5d44

2 files changed

Lines changed: 7 additions & 3 deletions

File tree

lib/galaxy/tool_shed/galaxy_install/install_manager.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,8 @@ def __handle_repository_contents(
188188
sample_files = irmm_metadata_dict.get("sample_files", [])
189189
tool_index_sample_files = stdtm.get_tool_index_sample_files(sample_files)
190190
tool_data_path = self.app.config.tool_data_path
191+
# Used to be created as a side effect of install_tool_data_tables; that no longer runs for non-DM repos.
192+
os.makedirs(tool_data_path, exist_ok=True)
191193
tool_util.copy_sample_files(tool_data_path, tool_index_sample_files, tool_path=tool_path)
192194
sample_files_copied = [str(s) for s in tool_index_sample_files]
193195
repository_tools_tups = irmm.get_repository_tools_tups()

test/integration/test_repository_operations.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import os
2+
import xml.etree.ElementTree as ET
23
from collections import namedtuple
34

45
from sqlalchemy import select
@@ -62,13 +63,14 @@ def test_tool_with_package_dependency_uninstall(self):
6263
self.uninstall_repository(*repo)
6364

6465
def test_non_data_manager_install_skips_data_table_registration(self):
65-
"""Non-Data-Manager repos must not register data tables on install."""
66+
"""Non-Data-Manager repos must not persist data table entries in shed_tool_data_table_conf.xml."""
6667
non_dm_repo = ("devteam", "bwa", "051eba708f43")
6768
non_dm_table_names = {"bwa_indexes", "bwa_mem_indexes"}
6869
self.install_repository(*non_dm_repo)
69-
registered = set(self._app.tool_data_tables.data_tables.keys())
70+
shed_conf = self._app.config.shed_tool_data_table_config
71+
registered = {t.get("name") for t in ET.parse(shed_conf).getroot().findall("table")}
7072
leaked = non_dm_table_names & registered
71-
assert not leaked, f"Unexpected data tables registered by non-DM repo: {sorted(leaked)}"
73+
assert not leaked, f"Unexpected data tables in {shed_conf}: {sorted(leaked)}"
7274

7375
def test_repository_update(self):
7476
response = self._install_repository(revision=REVISION_4, version="0.0.3", allow_upgraded=True)[0]

0 commit comments

Comments
 (0)