From 07c5d445da70630bcaca6aedffcb24034d7d8174 Mon Sep 17 00:00:00 2001 From: Nate Coraor Date: Wed, 13 May 2026 16:56:19 -0400 Subject: [PATCH] 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. --- lib/galaxy/tool_shed/galaxy_install/install_manager.py | 2 ++ test/integration/test_repository_operations.py | 8 +++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/galaxy/tool_shed/galaxy_install/install_manager.py b/lib/galaxy/tool_shed/galaxy_install/install_manager.py index 12a284cf045..cee14887f0d 100644 --- a/lib/galaxy/tool_shed/galaxy_install/install_manager.py +++ b/lib/galaxy/tool_shed/galaxy_install/install_manager.py @@ -188,6 +188,8 @@ class InstallRepositoryManager: sample_files = irmm_metadata_dict.get("sample_files", []) tool_index_sample_files = stdtm.get_tool_index_sample_files(sample_files) tool_data_path = self.app.config.tool_data_path + # Used to be created as a side effect of install_tool_data_tables; that no longer runs for non-DM repos. + os.makedirs(tool_data_path, exist_ok=True) tool_util.copy_sample_files(tool_data_path, tool_index_sample_files, tool_path=tool_path) sample_files_copied = [str(s) for s in tool_index_sample_files] repository_tools_tups = irmm.get_repository_tools_tups() diff --git a/test/integration/test_repository_operations.py b/test/integration/test_repository_operations.py index 33a0e5e9527..3c9a415f7e6 100644 --- a/test/integration/test_repository_operations.py +++ b/test/integration/test_repository_operations.py @@ -1,4 +1,5 @@ import os +import xml.etree.ElementTree as ET from collections import namedtuple from sqlalchemy import select @@ -62,13 +63,14 @@ class TestRepositoryInstallIntegrationTestCase(integration_util.IntegrationTestC self.uninstall_repository(*repo) def test_non_data_manager_install_skips_data_table_registration(self): - """Non-Data-Manager repos must not register data tables on install.""" + """Non-Data-Manager repos must not persist data table entries in shed_tool_data_table_conf.xml.""" non_dm_repo = ("devteam", "bwa", "051eba708f43") non_dm_table_names = {"bwa_indexes", "bwa_mem_indexes"} self.install_repository(*non_dm_repo) - registered = set(self._app.tool_data_tables.data_tables.keys()) + shed_conf = self._app.config.shed_tool_data_table_config + registered = {t.get("name") for t in ET.parse(shed_conf).getroot().findall("table")} leaked = non_dm_table_names & registered - assert not leaked, f"Unexpected data tables registered by non-DM repo: {sorted(leaked)}" + assert not leaked, f"Unexpected data tables in {shed_conf}: {sorted(leaked)}" def test_repository_update(self): response = self._install_repository(revision=REVISION_4, version="0.0.3", allow_upgraded=True)[0]