Skip to content

Commit

Permalink
Merge pull request #1407 from mvdbeek/robust_error_reports
Browse files Browse the repository at this point in the history
Fix running workflow tests when there are multiple tests
  • Loading branch information
mvdbeek authored Nov 16, 2023
2 parents c36a2fa + 45f5166 commit ec3661c
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
11 changes: 6 additions & 5 deletions planemo/engine/galaxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,13 @@ def _run(self, runnables, job_paths, output_collectors: Optional[List[Callable]]
results = []
if not output_collectors:
output_collectors = [lambda x: None] * len(runnables)
for runnable, job_path, collect_output in zip(runnables, job_paths, output_collectors):
self._ctx.vlog(f"Serving artifact [{runnable}] with Galaxy.")
with self.ensure_runnables_served([runnable]) as config:

with self.ensure_runnables_served(runnables) as config:
if self._ctx.verbose:
self._ctx.log(f"Running Galaxy with API configuration [{config.user_api_config}]")
for runnable, job_path, collect_output in zip(runnables, job_paths, output_collectors):
self._ctx.vlog(f"Serving artifact [{runnable}] with Galaxy.")
self._ctx.vlog(f"Running job path [{job_path}]")
if self._ctx.verbose:
self._ctx.log(f"Running Galaxy with API configuration [{config.user_api_config}]")
run_response = execute(self._ctx, config, runnable, job_path, **self._kwds)
results.append(run_response)
if collect_output is not None:
Expand Down
4 changes: 3 additions & 1 deletion planemo/engine/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,9 @@ def _run_test_cases(self, test_cases, test_timeout):
job_paths.append(job_path)
else:
job_paths.append(test_case.job_path)
output_collectors.append(lambda run_response: test_case.structured_test_data(run_response))
output_collectors.append(
lambda run_response, test_case=test_case: test_case.structured_test_data(run_response)
)
try:
run_responses = self._run(runnables, job_paths, output_collectors)
finally:
Expand Down
5 changes: 4 additions & 1 deletion tests/test_cmd_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ def test_data_manager_docker_mount(self):
@skip_if_environ("PLANEMO_SKIP_GALAXY_TESTS")
def test_workflow_test_simple_yaml(self):
"""Test testing a simple YAML workflow with Galaxy."""
with self._isolate():
with self._isolate() as test_dir:
random_lines = os.path.join(PROJECT_TEMPLATES_DIR, "demo", "randomlines.xml")
cat = os.path.join(PROJECT_TEMPLATES_DIR, "demo", "cat.xml")
test_artifact = os.path.join(TEST_DATA_DIR, "wf1.gxwf.yml")
Expand All @@ -104,6 +104,9 @@ def test_workflow_test_simple_yaml(self):
test_artifact,
]
self._check_exit_code(test_command, exit_code=0)
with open(os.path.join(test_dir, "tool_test_output.json")) as test_json:
tests_dict = json.load(test_json)
assert tests_dict["tests"][0]["id"] != tests_dict["tests"][1]["id"]

@skip_if_environ("PLANEMO_SKIP_GALAXY_TESTS")
def test_tool_test_timeout(self):
Expand Down

0 comments on commit ec3661c

Please sign in to comment.