From 44de95c0d7087a5822941959f9a062f6382e329b Mon Sep 17 00:00:00 2001 From: John Chilton Date: Thu, 13 Nov 2014 09:08:58 -0500 Subject: [PATCH] Allow setting up loc and tool data config files for testing cache data. Requires small changes to Galaxy which will be available in the December release. As an example see the following example tweaks to picard wrappers to enable this - https://github.com/jmchilton/picard/commit/4df8974384081ee1bb0f97e1bb8d7f935ba09d73. --- planemo/galaxy_config.py | 33 +++++++++++++++++++++++++-------- 1 file changed, 25 insertions(+), 8 deletions(-) diff --git a/planemo/galaxy_config.py b/planemo/galaxy_config.py index cbaf1baf1..a1b846d8b 100644 --- a/planemo/galaxy_config.py +++ b/planemo/galaxy_config.py @@ -95,21 +95,37 @@ def find_test_data(path, **kwds): if test_data: return os.path.abspath(test_data) else: - if not os.path.isdir(path): - tool_dir = os.path.dirname(path) - else: - tool_dir = path - for possible_dir in [tool_dir, "."]: - test_data = os.path.join(possible_dir, "test-data") - if os.path.exists(test_data): - return test_data + test_data = __search_tool_path_for(path, "test-data") + if test_data: + return test_data warn(NO_TEST_DATA_MESSAGE) return None +def find_tool_data_table(path, **kwds): + tool_data_table = kwds.get("tool_data_table", None) + if tool_data_table: + return os.path.abspath(tool_data_table) + else: + return __search_tool_path_for(path, "tool_data_table_conf.xml.test") + + +def __search_tool_path_for(path, target): + if not os.path.isdir(path): + tool_dir = os.path.dirname(path) + else: + tool_dir = path + for possible_dir in [tool_dir, "."]: + possible_path = os.path.join(possible_dir, target) + if os.path.exists(possible_path): + return possible_path + return None + + @contextlib.contextmanager def galaxy_config(tool_path, for_tests=False, **kwds): test_data_dir = find_test_data(tool_path, **kwds) + tool_data_table = find_tool_data_table(tool_path, **kwds) if kwds.get("install_galaxy", None): galaxy_root = None else: @@ -170,6 +186,7 @@ def config_join(*args): id_secret="${id_secret}", log_level="${log_level}", debug="${debug}", + tool_data_table_config_path=tool_data_table, integrated_tool_panel_config=("${temp_directory}/" "integrated_tool_panel_conf.xml"), # Use in-memory database for kombu to avoid database contention