Fix autoload of direct dependencies for python (#9630)
fixes #9624 merge_config_rules was using `strict=False` to check if a spec satisfies a constraint, which loosely translates to "this spec has no conflict with the constraint, so I can potentially add it to the spec". We want instead `strict=True` which means "the spec satisfies the constraint right now".
This commit is contained in:

committed by
GitHub

parent
534b71bdf1
commit
da537d2211
@@ -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)
|
||||
|
@@ -0,0 +1,8 @@
|
||||
enable:
|
||||
- tcl
|
||||
tcl:
|
||||
^mpich2:
|
||||
autoload: 'direct'
|
||||
|
||||
^python:
|
||||
autoload: 'direct'
|
@@ -276,3 +276,20 @@ def test_blacklist_implicits(
|
||||
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
|
||||
|
Reference in New Issue
Block a user