diff options
author | Massimiliano Culpo <massimiliano.culpo@gmail.com> | 2017-11-30 19:41:24 +0100 |
---|---|---|
committer | scheibelp <scheibel1@llnl.gov> | 2017-11-30 10:41:24 -0800 |
commit | f7c0e24f0a554c4e5a68d6c2671fcb1102b1219c (patch) | |
tree | b17d63f646197c57376c4c40810d8f993367a1f8 /lib | |
parent | 3dafbe901a2a2ade232f3221dd27786ee6f42097 (diff) | |
download | spack-f7c0e24f0a554c4e5a68d6c2671fcb1102b1219c.tar.gz spack-f7c0e24f0a554c4e5a68d6c2671fcb1102b1219c.tar.bz2 spack-f7c0e24f0a554c4e5a68d6c2671fcb1102b1219c.tar.xz spack-f7c0e24f0a554c4e5a68d6c2671fcb1102b1219c.zip |
'spack install': make conflict messages as verbose as 'spack spec' (#6436)
"spack spec" was providing helpful error information about conflicts
that was missing from "spack install", this updates "spack install"
to provide the same information.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/spack/spack/cmd/__init__.py | 7 | ||||
-rw-r--r-- | lib/spack/spack/test/cmd/install.py | 13 | ||||
-rw-r--r-- | lib/spack/spack/test/concretize.py | 13 | ||||
-rw-r--r-- | lib/spack/spack/test/conftest.py | 19 |
4 files changed, 37 insertions, 15 deletions
diff --git a/lib/spack/spack/cmd/__init__.py b/lib/spack/spack/cmd/__init__.py index 39eb4c2ae1..ec670b8d9c 100644 --- a/lib/spack/spack/cmd/__init__.py +++ b/lib/spack/spack/cmd/__init__.py @@ -127,7 +127,12 @@ def parse_specs(args, **kwargs): sys.exit(1) except spack.spec.SpecError as e: - tty.error(e.message) + + msgs = [e.message] + if e.long_message: + msgs.append(e.long_message) + + tty.error(*msgs) sys.exit(1) diff --git a/lib/spack/spack/test/cmd/install.py b/lib/spack/spack/test/cmd/install.py index 7bd6ebc160..54ef1e97db 100644 --- a/lib/spack/spack/test/cmd/install.py +++ b/lib/spack/spack/test/cmd/install.py @@ -33,7 +33,7 @@ import llnl.util.filesystem as fs import spack import spack.cmd.install from spack.spec import Spec -from spack.main import SpackCommand +from spack.main import SpackCommand, SpackCommandError install = SpackCommand('install') @@ -234,3 +234,14 @@ def test_install_overwrite( assert os.path.exists(spec.prefix) assert fs.hash_directory(spec.prefix) == expected_md5 assert fs.hash_directory(spec.prefix) != bad_md5 + + +@pytest.mark.usefixtures( + 'builtin_mock', 'mock_archive', 'mock_fetch', 'config', 'install_mockery', +) +def test_install_conflicts(conflict_spec): + # Make sure that spec with conflicts exit with 1 + with pytest.raises(SpackCommandError): + install(conflict_spec) + + assert install.returncode == 1 diff --git a/lib/spack/spack/test/concretize.py b/lib/spack/spack/test/concretize.py index f0d5ae131f..2611c91f87 100644 --- a/lib/spack/spack/test/concretize.py +++ b/lib/spack/spack/test/concretize.py @@ -94,19 +94,6 @@ def spec(request): return request.param -@pytest.fixture( - params=[ - 'conflict%clang', - 'conflict%clang+foo', - 'conflict-parent%clang', - 'conflict-parent@0.9^conflict~foo' - ] -) -def conflict_spec(request): - """Spec to be concretized""" - return request.param - - @pytest.mark.usefixtures('config', 'builtin_mock') class TestConcretize(object): def test_concretize(self, spec): diff --git a/lib/spack/spack/test/conftest.py b/lib/spack/spack/test/conftest.py index 5ac4de1851..8d83d43ee0 100644 --- a/lib/spack/spack/test/conftest.py +++ b/lib/spack/spack/test/conftest.py @@ -690,3 +690,22 @@ class MockPackageMultiRepo(object): import collections Repo = collections.namedtuple('Repo', ['namespace']) return Repo('mockrepo') + +########## +# Specs of various kind +########## + + +@pytest.fixture( + params=[ + 'conflict%clang', + 'conflict%clang+foo', + 'conflict-parent%clang', + 'conflict-parent@0.9^conflict~foo' + ] +) +def conflict_spec(request): + """Specs which violate constraints specified with the "conflicts" + directive in the "conflict" package. + """ + return request.param |