summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/spack/spack/spec.py3
-rw-r--r--lib/spack/spack/test/concretize.py5
2 files changed, 7 insertions, 1 deletions
diff --git a/lib/spack/spack/spec.py b/lib/spack/spack/spec.py
index 0b9500246a..03f334597a 100644
--- a/lib/spack/spack/spec.py
+++ b/lib/spack/spack/spec.py
@@ -2134,6 +2134,8 @@ class Spec(object):
consistent with requirements of its packages. See flatten() and
normalize() for more details on this.
"""
+ import spack.concretize
+
if not self.name:
raise spack.error.SpecError(
"Attempting to concretize anonymous spec")
@@ -2145,7 +2147,6 @@ class Spec(object):
force = False
user_spec_deps = self.flat_dependencies(copy=False)
- import spack.concretize
concretizer = spack.concretize.Concretizer(self.copy())
while changed:
changes = (self.normalize(force, tests=tests,
diff --git a/lib/spack/spack/test/concretize.py b/lib/spack/spack/test/concretize.py
index ec594e4088..fd0e185168 100644
--- a/lib/spack/spack/test/concretize.py
+++ b/lib/spack/spack/test/concretize.py
@@ -633,3 +633,8 @@ class TestConcretize(object):
s = Spec('mpileaks %gcc@4.5:')
s.concretize()
assert str(s.compiler.version) == '4.5.0'
+
+ def test_concretize_anonymous(self):
+ with pytest.raises(spack.error.SpecError):
+ s = Spec('+variant')
+ s.concretize()