expand on test and add comments on expected behaviors

This commit is contained in:
Gregory Becker 2025-02-07 15:00:33 -08:00
parent b757500d9e
commit 401c183de9

View File

@ -1462,17 +1462,27 @@ def test_no_reuse_when_variant_condition_does_not_hold(self, mutable_database, m
def test_reuse_by_namespace(self, mutable_database, mock_packages):
spack.config.set("concretizer:reuse", True)
# Set spack to prefer an older version when doing new builds, but prioritize reuse higher
spack.config.set("packages:libelf", {"version": ["0.8.10"]})
# Expected behavior is to reuse the libelf@0.8.13 from mutable database
# despite configured preference for older version
reuse = spack.concretize.concretize_one("libelf")
assert reuse.installed
assert reuse.satisfies("@0.8.13") # version installed in mutable_database
assert reuse.satisfies("@0.8.13")
# Reuse is turned off, so preference will be respected
spack.config.set("concretizer:reuse", {"namespaces": []})
noreuse = spack.concretize.concretize_one("libelf")
assert not noreuse.installed
assert noreuse.satisfies("@0.8.10")
# Expected behavior same as first concretization
spack.config.set("concretizer:reuse", {"namespaces": ["builtin.mock"]})
noreuse = spack.concretize.concretize_one("libelf")
assert noreuse.installed
assert noreuse.satisfies("@0.8.13")
def test_reuse_with_flags(self, mutable_database, mutable_config):
spack.config.set("concretizer:reuse", True)
spec = spack.concretize.concretize_one("pkg-a cflags=-g cxxflags=-g")