Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_tar_from_git(self):
with self._isolate() as f:
with self._git_configured():
dest = join(f, "single_tool")
self._copy_repo("single_tool", dest)
shell(" && ".join([
"cd %s" % dest,
"git init",
"git add .",
"git commit -m 'initial commit'"
]))
upload_command = [
"shed_update", "--force_repository_creation",
"git+single_tool/.git"
]
upload_command.extend(self._shed_args())
self._check_exit_code(upload_command)
self._verify_single_uploaded(f, ["single_tool"])
def cli(ctx, path, **kwds):
"""Generate human readable tool test reports.
Creates reports in various formats (HTML, text, markdown)
from the structured test output (tool_test_output.json).
"""
if not os.path.exists(path):
io.error("Failed to tool test json file at %s" % path)
return 1
test_data = StructuredData(path)
test_data.calculate_summary_data_if_needed()
handle_reports(ctx, test_data.structured_data, kwds)
):
num_tests = test_results.num_tests
num_problems = test_results.num_problems
if num_tests == 0:
warn(NO_TESTS_MESSAGE)
return
if num_problems == 0:
info(ALL_TESTS_PASSED_MESSAGE % num_tests)
if num_problems:
html_report_file = test_results.output_html_path
message_args = (num_problems, num_tests, html_report_file)
message = PROBLEM_COUNT_MESSAGE % message_args
warn(message)
for testcase_el in test_results.xunit_testcase_elements:
structured_data_tests = test_results.structured_data_tests
__summarize_test_case(structured_data_tests, testcase_el, **kwds)
def __handle_summary(
test_results,
**kwds
):
summary_style = kwds.get("summary")
if summary_style == "none":
return
if test_results.has_details:
__summarize_tests_full(
test_results,
**kwds
)
else:
if test_results.exit_code:
warn(GENERIC_PROBLEMS_MESSAGE % test_results.output_html_path)
else:
info(GENERIC_TESTS_PASSED_MESSAGE)
def __summarize_tests_full(
test_results,
**kwds
):
num_tests = test_results.num_tests
num_problems = test_results.num_problems
if num_tests == 0:
warn(NO_TESTS_MESSAGE)
return
if num_problems == 0:
info(ALL_TESTS_PASSED_MESSAGE % num_tests)
if num_problems:
html_report_file = test_results.output_html_path
message_args = (num_problems, num_tests, html_report_file)
message = PROBLEM_COUNT_MESSAGE % message_args
warn(message)
for testcase_el in test_results.xunit_testcase_elements:
structured_data_tests = test_results.structured_data_tests
__summarize_test_case(structured_data_tests, testcase_el, **kwds)
def test_shed_diff(self):
with self._isolate_repo("single_tool") as f:
upload_command = ["shed_upload", "--force_repository_creation"]
upload_command.extend(self._shed_args())
self._check_exit_code(upload_command)
io.write_file(
join(f, "related_file"),
"A related non-tool file (modified).\n",
)
self._check_diff(f, True)
self._check_diff(f, False)
def test_diff_recursive(self):
with self._isolate_repo("multi_repos_nested") as f:
self._shed_create(recursive=True)
diff_command = ["shed_diff", "-r"]
diff_command.extend(self._shed_args(read_only=True))
self._check_exit_code(diff_command, exit_code=0)
io.write_file(
join(f, "cat1", "related_file"),
"A related non-tool file (modified).\n",
)
self._check_exit_code(diff_command, exit_code=1)
def _copy_repo(self, name, dest):
repo = os.path.join(TEST_REPOS_DIR, name)
io.shell(['cp', '-r', "%s/." % repo, dest])
def _repos(self, **kwds):
return shed.build_effective_repositories(self.temp_directory, **kwds)
def test_ToolInput_get_formatted_repeat_desc():
"""Test :func:`planemo.training.tool_input.ToolInput.get_formatted_repeat_desc`."""
tool_input = ToolInput(
tool_inp_desc=tool_inp_desc[2],
wf_param_values=wf_param_values,
wf_steps=wf_steps,
level=1,
should_be_there=True,
force_default=False)
repeat_desc = tool_input.get_formatted_repeat_desc()
assert '> - In *"' in repeat_desc
assert '> - {% icon param-repeat %} *"Insert' in repeat_desc
assert '> -' in repeat_desc