Skip to content
Snippets Groups Projects
Unverified Commit da537d22 authored by Massimiliano Culpo's avatar Massimiliano Culpo Committed by GitHub
Browse files

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".
parent 534b71bd
No related branches found
No related tags found
No related merge requests found
...@@ -173,7 +173,7 @@ def merge_config_rules(configuration, spec): ...@@ -173,7 +173,7 @@ def merge_config_rules(configuration, spec):
if constraint.endswith(':'): if constraint.endswith(':'):
constraint = constraint.strip(':') constraint = constraint.strip(':')
override = True override = True
if spec.satisfies(constraint): if spec.satisfies(constraint, strict=True):
if override: if override:
spec_configuration = {} spec_configuration = {}
update_dictionary_extending_lists(spec_configuration, action) update_dictionary_extending_lists(spec_configuration, action)
......
enable:
- tcl
tcl:
^mpich2:
autoload: 'direct'
^python:
autoload: 'direct'
...@@ -276,3 +276,20 @@ def test_blacklist_implicits( ...@@ -276,3 +276,20 @@ def test_blacklist_implicits(
for item in callpath_specs: for item in callpath_specs:
writer = writer_cls(item) writer = writer_cls(item)
assert writer.conf.blacklisted 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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment