Skip to content

Commit

Permalink
Merge pull request #3482 from jmchilton/placeholder_fixes
Browse files Browse the repository at this point in the history
[17.01] Fix logs and unit tests for Conda placeholder bug resolution.
  • Loading branch information
martenson committed Jan 25, 2017
2 parents 29c0c41 + 04eee64 commit 71876f6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 21 deletions.
5 changes: 0 additions & 5 deletions lib/galaxy/tools/deps/resolvers/conda.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,6 @@ def get_option(name):

self.conda_prefix_parent = os.path.dirname(conda_prefix)

# warning is related to conda problem discussed in https://github.com/galaxyproject/galaxy/issues/2537, remove when that is resolved
conda_prefix_warning_length = 50
if len(conda_prefix) >= conda_prefix_warning_length:
log.warning("Conda install prefix '%s' is %d characters long, this can cause problems with package installation, consider setting a shorter prefix (conda_prefix in galaxy.ini)" % (conda_prefix, len(conda_prefix)))

condarc_override = get_option("condarc_override")
if condarc_override is None:
condarc_override = os.path.join(
Expand Down
25 changes: 9 additions & 16 deletions test/unit/tools/test_conda_resolution.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
conda_util,
DependencyManager
)
from galaxy.tools.deps.requirements import ToolRequirement
from galaxy.tools.deps.resolvers.conda import CondaDependencyResolver


Expand All @@ -29,25 +30,16 @@ def test_conda_resolution():
auto_install=True,
use_path_exec=False, # For the test ensure this is always a clean install
)
conda_context = resolver.conda_context
assert len(list(conda_util.installed_conda_targets(conda_context))) == 0
dependency = resolver.resolve(name="samtools", version=None, type="package", job_directory=job_dir)
req = ToolRequirement(name="samtools", version=None, type="package")
dependency = resolver.resolve(req, job_directory=job_dir)
assert dependency.shell_commands(None) is not None
installed_targets = list(conda_util.installed_conda_targets(conda_context))
assert len(installed_targets) == 1
samtools_target = installed_targets[0]
assert samtools_target.package == "samtools"
assert samtools_target.version is None
finally:
shutil.rmtree(base_path)


@skip_unless_environ("GALAXY_TEST_INCLUDE_SLOW")
def test_conda_resolution_failure():
"""This test is specifically designed to trigger https://github.com/rtfd/readthedocs.org/issues/1902
and thus it expects the install to fail. If this test fails it is a sign that the upstream
conda issue has been fixed.
"""
def test_against_conda_prefix_regression():
"""Test that would fail if https://github.com/rtfd/readthedocs.org/issues/1902 regressed."""

base_path = mkdtemp(prefix='x' * 80) # a ridiculously long prefix
try:
Expand All @@ -61,9 +53,10 @@ def test_conda_resolution_failure():
)
conda_context = resolver.conda_context
assert len(list(conda_util.installed_conda_targets(conda_context))) == 0
dependency = resolver.resolve(name="samtools", version=None, type="package", job_directory=job_dir)
assert dependency.shell_commands(None) is None # install should fail
req = ToolRequirement(name="samtools", version="0.1.16", type="package")
dependency = resolver.resolve(req, job_directory=job_dir)
assert dependency.shell_commands(None) is not None # install should not fail anymore
installed_targets = list(conda_util.installed_conda_targets(conda_context))
assert len(installed_targets) == 0
assert len(installed_targets) > 0
finally:
shutil.rmtree(base_path)

0 comments on commit 71876f6

Please sign in to comment.