summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/spack/spack/modules/common.py2
-rw-r--r--lib/spack/spack/test/data/modules/tcl/autoload_with_constraints.yaml8
-rw-r--r--lib/spack/spack/test/modules/tcl.py17
3 files changed, 26 insertions, 1 deletions
diff --git a/lib/spack/spack/modules/common.py b/lib/spack/spack/modules/common.py
index 1ed826a844..6e0d062156 100644
--- a/lib/spack/spack/modules/common.py
+++ b/lib/spack/spack/modules/common.py
@@ -173,7 +173,7 @@ def merge_config_rules(configuration, spec):
if constraint.endswith(':'):
constraint = constraint.strip(':')
override = True
- if spec.satisfies(constraint):
+ if spec.satisfies(constraint, strict=True):
if override:
spec_configuration = {}
update_dictionary_extending_lists(spec_configuration, action)
diff --git a/lib/spack/spack/test/data/modules/tcl/autoload_with_constraints.yaml b/lib/spack/spack/test/data/modules/tcl/autoload_with_constraints.yaml
new file mode 100644
index 0000000000..52796cad5b
--- /dev/null
+++ b/lib/spack/spack/test/data/modules/tcl/autoload_with_constraints.yaml
@@ -0,0 +1,8 @@
+enable:
+ - tcl
+tcl:
+ ^mpich2:
+ autoload: 'direct'
+
+ ^python:
+ autoload: 'direct'
diff --git a/lib/spack/spack/test/modules/tcl.py b/lib/spack/spack/test/modules/tcl.py
index 9846b20482..b7b6a023ce 100644
--- a/lib/spack/spack/test/modules/tcl.py
+++ b/lib/spack/spack/test/modules/tcl.py
@@ -276,3 +276,20 @@ class TestTcl(object):
for item in callpath_specs:
writer = writer_cls(item)
assert writer.conf.blacklisted
+
+ @pytest.mark.regression('9624')
+ @pytest.mark.db
+ def test_autoload_with_constraints(
+ self, modulefile_content, module_configuration, database
+ ):
+ """Tests the automatic loading of direct dependencies."""
+
+ module_configuration('autoload_with_constraints')
+
+ # Test the mpileaks that should have the autoloaded dependencies
+ content = modulefile_content('mpileaks ^mpich2')
+ assert len([x for x in content if 'is-loaded' in x]) == 2
+
+ # Test the mpileaks that should NOT have the autoloaded dependencies
+ content = modulefile_content('mpileaks ^mpich')
+ assert len([x for x in content if 'is-loaded' in x]) == 0