summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/spack/spack/spec.py4
-rw-r--r--lib/spack/spack/util/mock_package.py8
2 files changed, 8 insertions, 4 deletions
diff --git a/lib/spack/spack/spec.py b/lib/spack/spack/spec.py
index 370a5d2f0c..f7a78863d4 100644
--- a/lib/spack/spack/spec.py
+++ b/lib/spack/spack/spec.py
@@ -3617,8 +3617,8 @@ class Spec(object):
def _cmp_node(self):
"""Yield comparable elements of just *this node* and not its deps."""
- yield self.name or ''
- yield self.namespace or ''
+ yield self.name
+ yield self.namespace
yield self.versions
yield self.variants
yield self.compiler
diff --git a/lib/spack/spack/util/mock_package.py b/lib/spack/spack/util/mock_package.py
index 0b5e681f26..847177ae05 100644
--- a/lib/spack/spack/util/mock_package.py
+++ b/lib/spack/spack/util/mock_package.py
@@ -81,8 +81,8 @@ class MockPackageMultiRepo(object):
def __init__(self):
self.spec_to_pkg = {}
- self.namespace = ''
- self.full_namespace = 'spack.pkg.mock'
+ self.namespace = 'mock' # repo namespace
+ self.full_namespace = 'spack.pkg.mock' # python import namespace
def get(self, spec):
if not isinstance(spec, spack.spec.Spec):
@@ -92,6 +92,10 @@ class MockPackageMultiRepo(object):
return self.spec_to_pkg[spec.name]
def get_pkg_class(self, name):
+ namespace, _, name = name.rpartition(".")
+ if namespace and namespace != self.namespace:
+ raise spack.repo.InvalidNamespaceError(
+ "bad namespace: %s" % self.namespace)
return self.spec_to_pkg[name]
def exists(self, name):