Skip to content

Commit

Permalink
Fix test_run_gxtool_randomlines test on Galaxy dev branch
Browse files Browse the repository at this point in the history
which was failing with:

```
E           galaxy.tool_util.provided_metadata INFO 2023-06-19 12:49:16,823 [pN:main.1,p:15735,tN:LocalRunner.work_thread-0] One or more tool outputs is marked as failed ({'type': 'dataset', 'ext': 'data', 'dataset_id': 1, 'stderr': 'Unable to fetch file:///home/runner/work/planemo/planemo/tests/data/hello.txt\nCould not find handler for URI [file:///home/runner/work/planemo/planemo/tests/data/hello.txt]', 'failed': True}).
```

After galaxyproject/galaxy#15497 and
follow-up galaxyproject/galaxy#15794 ,
data upload using "file://" URLs is allowed only for Galaxy admins.
This adds a basic ``file_sources_conf.yml`` configuration file that
allows planemo to upload from the test data directory.
  • Loading branch information
nsoranzo committed Jun 20, 2023
1 parent 2abf1a2 commit 6b2e31d
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
16 changes: 16 additions & 0 deletions planemo/galaxy/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,14 @@
</job_metrics>
"""

FILE_SOURCES_TEMPLATE = """
- type: posix
root: '${test_data_dir}'
id: test_data_dir
label: Test data directory
doc: Test data directory for the runnables being tested
"""

TOOL_SHEDS_CONF = """<tool_sheds>
<tool_shed name="Target Shed" url="${shed_target_url}" />
</tool_sheds>
Expand Down Expand Up @@ -362,6 +370,7 @@ def config_join(*args):
all_tool_paths = _all_tool_paths(runnables, galaxy_root=galaxy_root, extra_tools=kwds.get("extra_tools"))
_handle_job_config_file(config_directory, server_name, test_data_dir, all_tool_paths, kwds)
_handle_job_metrics(config_directory, kwds)
_handle_file_sources(config_directory, test_data_dir, kwds)
_handle_refgenie_config(config_directory, galaxy_root, kwds)
file_path = kwds.get("file_path") or config_join("files")
_ensure_directory(file_path)
Expand Down Expand Up @@ -1384,6 +1393,13 @@ def _handle_job_metrics(config_directory, kwds):
kwds["job_metrics_config_file"] = metrics_conf


def _handle_file_sources(config_directory, test_data_dir, kwds):
file_sources_conf = os.path.join(config_directory, "file_sources_conf.yml")
file_sources_conf_contents = _sub(FILE_SOURCES_TEMPLATE, {"test_data_dir": test_data_dir})
write_file(file_sources_conf, file_sources_conf_contents)
kwds["file_sources_config_file"] = file_sources_conf


def _handle_refgenie_config(config_directory, galaxy_root, kwds):
refgenie_dir = os.path.join(config_directory, "refgenie")
_ensure_directory(refgenie_dir)
Expand Down
2 changes: 2 additions & 0 deletions tests/test_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ def test_run_gxtool_randomlines(self):
"--no_dependency_resolution",
"--galaxy_branch",
target_galaxy_branch(),
"--test_data",
TEST_DATA_DIR,
tool_path,
job_path,
]
Expand Down

0 comments on commit 6b2e31d

Please sign in to comment.