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

test: check if extra files were created in Galaxy's file_path #1190

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
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
21 changes: 20 additions & 1 deletion planemo/galaxy/test/actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import io
import json
import os
import re
from distutils.dir_util import copy_tree

import click
Expand Down Expand Up @@ -121,11 +122,29 @@ def run_in_config(ctx, config, run=run_galaxy_command, test_data_target_dir=None
return_code,
)

ec = test_results.exit_code
structured_data = test_results.structured_data
extra_files = []
# check if tools created extra files in the file_path all files in the files path
# - end with '.dat' or
# - are contained in a directory `dataset_.*_files`
if config.env.get("GALAXY_CONFIG_OVERRIDE_FILE_PATH"):
for (path, dirs, files) in os.walk(config.env.get("GALAXY_CONFIG_OVERRIDE_FILE_PATH")):
dirs[:] = [d for d in dirs if not re.match(r'^dataset_[^/]*_files$', d)]
for name in files:
if not name.endswith(".dat"):
extra_files.append(os.path.join(path, name))
if len(extra_files) > 0:
msg = f"One of the tested tools wrote to Galaxy's files dir: {extra_files}"
for i in range(len(structured_data["tests"])):
structured_data["tests"][i]["data"]["status"] = "failure"
structured_data["tests"][i]["data"]["job"]["stderr"] += msg
error(msg)
ec = 1
return handle_reports_and_summary(
ctx,
structured_data,
exit_code=test_results.exit_code,
exit_code=ec,
kwds=kwds
)

Expand Down