From 431a32dd532fc65fc32e68892fd964f373bc57e3 Mon Sep 17 00:00:00 2001 From: John Chilton Date: Fri, 18 Aug 2017 10:30:26 -0400 Subject: [PATCH] Allow unit testing tool init to specify paths. --- lib/galaxy/app_unittest_utils/tools_support.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/lib/galaxy/app_unittest_utils/tools_support.py b/lib/galaxy/app_unittest_utils/tools_support.py index ffe2e3abc4ac..5dc91ff30b24 100644 --- a/lib/galaxy/app_unittest_utils/tools_support.py +++ b/lib/galaxy/app_unittest_utils/tools_support.py @@ -83,14 +83,18 @@ def _init_tool( tool_id="test_tool", extra_file_contents=None, extra_file_path=None, + tool_path=None, ): + if tool_path is None: + self.tool_file = os.path.join(self.test_directory, filename) + contents_template = string.Template(tool_contents) + tool_contents = contents_template.safe_substitute(dict(version=version, profile=profile, tool_id=tool_id)) + self.__write_tool(tool_contents) + if extra_file_contents and extra_file_path: + self.__write_tool(extra_file_contents, path=os.path.join(self.test_directory, extra_file_path)) + else: + self.tool_file = tool_path self._init_app_for_tools() - self.tool_file = os.path.join(self.test_directory, filename) - contents_template = string.Template(tool_contents) - tool_contents = contents_template.safe_substitute(dict(version=version, profile=profile, tool_id=tool_id)) - self.__write_tool(tool_contents) - if extra_file_contents and extra_file_path: - self.__write_tool(extra_file_contents, path=os.path.join(self.test_directory, extra_file_path)) return self.__setup_tool() def _init_tool_for_path(self, tool_file):