Skip to content

Commit f3cafaa

Browse files
committed
Fix shed_test and shed_serve for test/local tool sheds.
1 parent 9b860f7 commit f3cafaa

File tree

3 files changed

+25
-3
lines changed

3 files changed

+25
-3
lines changed

planemo/galaxy_config.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
from planemo.io import write_file
2121
from planemo.io import kill_pid_file
2222
from planemo import git
23+
from planemo.shed import tool_shed_url
2324
from planemo.bioblend import (
2425
galaxy,
2526
ensure_module,
@@ -73,6 +74,11 @@
7374
</dependency_resolvers>
7475
"""
7576

77+
TOOL_SHEDS_CONF = """<tool_sheds>
78+
<tool_shed name="Target Shed" url="${shed_target_url}" />
79+
</tool_sheds>
80+
"""
81+
7682
# Provide some shortcuts for simple/common dependency resolutions strategies.
7783
STOCK_DEPENDENCY_RESOLUTION_STRATEGIES = {
7884
"brew_dependency_resolution": BREW_DEPENDENCY_RESOLUTION_CONF,
@@ -128,6 +134,9 @@ def config_join(*args):
128134
tool_conf = config_join("tool_conf.xml")
129135
database_location = config_join("galaxy.sqlite")
130136
shed_tools_path = config_join("shed_tools")
137+
sheds_config_path = _configure_sheds_config_file(
138+
config_directory, **kwds
139+
)
131140
preseeded_database = True
132141
master_api_key = kwds.get("master_api_key", "test_key")
133142
dependency_dir = os.path.join(config_directory, "deps")
@@ -166,6 +175,7 @@ def config_join(*args):
166175
file_path="${temp_directory}/files",
167176
new_file_path="${temp_directory}/tmp",
168177
tool_config_file=tool_config_file,
178+
tool_sheds_config_file=sheds_config_path,
169179
check_migrate_tools="False",
170180
manage_dependency_relationships="False",
171181
job_working_directory="${temp_directory}/job_working_directory",
@@ -431,6 +441,17 @@ def _search_tool_path_for(path, target, extra_paths=[]):
431441
return None
432442

433443

444+
def _configure_sheds_config_file(config_directory, **kwds):
445+
if "shed_target" not in kwds:
446+
kwds = kwds.copy()
447+
kwds["shed_target"] = "toolshed"
448+
shed_target_url = tool_shed_url(kwds)
449+
contents = _sub(TOOL_SHEDS_CONF, {"shed_target_url": shed_target_url})
450+
tool_sheds_conf = os.path.join(config_directory, "tool_sheds_conf.xml")
451+
write_file(tool_sheds_conf, contents)
452+
return tool_sheds_conf
453+
454+
434455
def _tool_conf_entry_for(tool_paths):
435456
tool_definitions = ""
436457
for tool_path in tool_paths:

planemo/shed/__init__.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@ def tool_shed_client(ctx=None, **kwds):
322322
def prop(key):
323323
return kwds.get("shed_%s" % key, None) or shed_config.get(key, None)
324324

325-
url = _tool_shed_url(kwds)
325+
url = tool_shed_url(kwds)
326326
if read_only:
327327
key = None
328328
email = None
@@ -608,7 +608,7 @@ def shed_repo_type(config, name):
608608
return repo_type
609609

610610

611-
def _tool_shed_url(kwds):
611+
def tool_shed_url(kwds):
612612
url = kwds.get("shed_target")
613613
if url in SHED_SHORT_NAMES:
614614
url = SHED_SHORT_NAMES[url]
@@ -1217,6 +1217,7 @@ class RealizationException(Exception):
12171217
'for_each_repository',
12181218
'api_exception_to_message',
12191219
'tool_shed_client',
1220+
'tool_shed_url',
12201221
'diff_repo',
12211222
'download_tarball',
12221223
'shed_init',

tests/test_shed_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
class ShedTestTestCase(CliTestCase):
1313

1414
@skip_if_environ("PLANEMO_SKIP_GALAXY_TESTS")
15-
def test_serve(self):
15+
def test_shed_test(self):
1616
fastqc_path = os.path.join(TEST_REPOS_DIR, "fastqc")
1717
test_cmd = [
1818
"shed_test",

0 commit comments

Comments
 (0)