Skip to content

Commit

Permalink
Merge pull request #12969 from common-workflow-lab/unit_testing_init_…
Browse files Browse the repository at this point in the history
…tool_paths

Allow unit testing tool init to specify paths.
  • Loading branch information
jmchilton authored Nov 23, 2021
2 parents 1f8ac6c + 431a32d commit 9081c3f
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions lib/galaxy/app_unittest_utils/tools_support.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit 9081c3f

Please sign in to comment.