Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow unit testing tool init to specify paths. #12969

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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