'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.
This commit is contained in:
parent
3dafbe901a
commit
f7c0e24f0a
@ -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)
|
||||
|
||||
|
||||
|
@ -33,7 +33,7 @@
|
||||
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
|
||||
|
@ -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):
|
||||
|
@ -690,3 +690,22 @@ def repo_for_pkg(self, name):
|
||||
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
|
||||
|
Loading…
Reference in New Issue
Block a user