tests: fix side effects of default_config fixture (#41361)

* tests: default_config drop scope

* use default_config elsewhere

* use parse_install_tree for missing defaults in default config
This commit is contained in:
Harmen Stoppels 2023-11-30 18:19:10 +01:00
parent f1b2515ce1
commit 50710c2b6e
2 changed files with 4 additions and 4 deletions

View file

@ -1239,11 +1239,11 @@ def test_user_config_path_is_default_when_env_var_is_empty(working_env):
assert os.path.expanduser("~%s.spack" % os.sep) == spack.paths._get_user_config_path()
def test_default_install_tree(monkeypatch):
def test_default_install_tree(monkeypatch, default_config):
s = spack.spec.Spec("nonexistent@x.y.z %none@a.b.c arch=foo-bar-baz")
monkeypatch.setattr(s, "dag_hash", lambda: "abc123")
projection = spack.config.get("config:install_tree:projections:all", scope="defaults")
assert s.format(projection) == "foo-bar-baz/none-a.b.c/nonexistent-x.y.z-abc123"
_, _, projections = spack.store.parse_install_tree(spack.config.get("config"))
assert s.format(projections["all"]) == "foo-bar-baz/none-a.b.c/nonexistent-x.y.z-abc123"
def test_local_config_can_be_disabled(working_env):

View file

@ -629,7 +629,7 @@ def platform_config():
spack.config.add_default_platform_scope(spack.platforms.real_host().name)
@pytest.fixture(scope="session")
@pytest.fixture
def default_config():
"""Isolates the default configuration from the user configs.