diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/spack/spack/spec.py | 5 | ||||
-rw-r--r-- | lib/spack/spack/test/spec_semantics.py | 7 |
2 files changed, 10 insertions, 2 deletions
diff --git a/lib/spack/spack/spec.py b/lib/spack/spack/spec.py index 47ff0c5d06..b6f961e09f 100644 --- a/lib/spack/spack/spec.py +++ b/lib/spack/spack/spec.py @@ -3009,8 +3009,9 @@ class Spec(object): if not self._dependencies: return False - selfdeps = self.traverse(root=False) - otherdeps = other.traverse(root=False) + # use list to prevent double-iteration + selfdeps = list(self.traverse(root=False)) + otherdeps = list(other.traverse(root=False)) if not all(any(d.satisfies(dep, strict=True) for d in selfdeps) for dep in otherdeps): return False diff --git a/lib/spack/spack/test/spec_semantics.py b/lib/spack/spack/test/spec_semantics.py index a258e45826..50a1731dfe 100644 --- a/lib/spack/spack/test/spec_semantics.py +++ b/lib/spack/spack/test/spec_semantics.py @@ -1014,6 +1014,13 @@ class TestSpecSematics(object): with pytest.raises(UnknownVariantError, match=r'package has no such'): s.concretize() + @pytest.mark.regression('18527') + def test_satisfies_dependencies_ordered(self): + d = Spec('zmpi ^fake') + s = Spec('mpileaks') + s._add_dependency(d, ()) + assert s.satisfies('mpileaks ^zmpi ^fake', strict=True) + @pytest.mark.regression('3887') @pytest.mark.parametrize('spec_str', [ |