Skip to content

Commit

Permalink
Fix shed_test and shed_serve for test/local tool sheds.
Browse files Browse the repository at this point in the history
  • Loading branch information
jmchilton committed May 22, 2015
1 parent 9b860f7 commit f3cafaa
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 3 deletions.
21 changes: 21 additions & 0 deletions planemo/galaxy_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
from planemo.io import write_file
from planemo.io import kill_pid_file
from planemo import git
from planemo.shed import tool_shed_url
from planemo.bioblend import (
galaxy,
ensure_module,
Expand Down Expand Up @@ -73,6 +74,11 @@
</dependency_resolvers>
"""

TOOL_SHEDS_CONF = """<tool_sheds>
<tool_shed name="Target Shed" url="${shed_target_url}" />
</tool_sheds>
"""

# Provide some shortcuts for simple/common dependency resolutions strategies.
STOCK_DEPENDENCY_RESOLUTION_STRATEGIES = {
"brew_dependency_resolution": BREW_DEPENDENCY_RESOLUTION_CONF,
Expand Down Expand Up @@ -128,6 +134,9 @@ def config_join(*args):
tool_conf = config_join("tool_conf.xml")
database_location = config_join("galaxy.sqlite")
shed_tools_path = config_join("shed_tools")
sheds_config_path = _configure_sheds_config_file(
config_directory, **kwds
)
preseeded_database = True
master_api_key = kwds.get("master_api_key", "test_key")
dependency_dir = os.path.join(config_directory, "deps")
Expand Down Expand Up @@ -166,6 +175,7 @@ def config_join(*args):
file_path="${temp_directory}/files",
new_file_path="${temp_directory}/tmp",
tool_config_file=tool_config_file,
tool_sheds_config_file=sheds_config_path,
check_migrate_tools="False",
manage_dependency_relationships="False",
job_working_directory="${temp_directory}/job_working_directory",
Expand Down Expand Up @@ -431,6 +441,17 @@ def _search_tool_path_for(path, target, extra_paths=[]):
return None


def _configure_sheds_config_file(config_directory, **kwds):
if "shed_target" not in kwds:
kwds = kwds.copy()
kwds["shed_target"] = "toolshed"
shed_target_url = tool_shed_url(kwds)
contents = _sub(TOOL_SHEDS_CONF, {"shed_target_url": shed_target_url})
tool_sheds_conf = os.path.join(config_directory, "tool_sheds_conf.xml")
write_file(tool_sheds_conf, contents)
return tool_sheds_conf


def _tool_conf_entry_for(tool_paths):
tool_definitions = ""
for tool_path in tool_paths:
Expand Down
5 changes: 3 additions & 2 deletions planemo/shed/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ def tool_shed_client(ctx=None, **kwds):
def prop(key):
return kwds.get("shed_%s" % key, None) or shed_config.get(key, None)

url = _tool_shed_url(kwds)
url = tool_shed_url(kwds)
if read_only:
key = None
email = None
Expand Down Expand Up @@ -608,7 +608,7 @@ def shed_repo_type(config, name):
return repo_type


def _tool_shed_url(kwds):
def tool_shed_url(kwds):
url = kwds.get("shed_target")
if url in SHED_SHORT_NAMES:
url = SHED_SHORT_NAMES[url]
Expand Down Expand Up @@ -1217,6 +1217,7 @@ class RealizationException(Exception):
'for_each_repository',
'api_exception_to_message',
'tool_shed_client',
'tool_shed_url',
'diff_repo',
'download_tarball',
'shed_init',
Expand Down
2 changes: 1 addition & 1 deletion tests/test_shed_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
class ShedTestTestCase(CliTestCase):

@skip_if_environ("PLANEMO_SKIP_GALAXY_TESTS")
def test_serve(self):
def test_shed_test(self):
fastqc_path = os.path.join(TEST_REPOS_DIR, "fastqc")
test_cmd = [
"shed_test",
Expand Down

0 comments on commit f3cafaa

Please sign in to comment.