From 55cc228307740197eced1a0bb4711cddd790a9ef Mon Sep 17 00:00:00 2001 From: Gregory Becker Date: Mon, 25 Nov 2024 17:34:17 -0800 Subject: [PATCH] tests: refactor for robustness, avoid dependence on path parsing --- lib/spack/spack/test/stage.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/spack/spack/test/stage.py b/lib/spack/spack/test/stage.py index ad0d53b9508..97f79ed0d60 100644 --- a/lib/spack/spack/test/stage.py +++ b/lib/spack/spack/test/stage.py @@ -754,14 +754,15 @@ def test_get_stage_root_bad_path(self, clear_stage_root): # Make sure the cached stage path values are unchanged. assert spack.stage._stage_root is None - def test_get_stage_root_empty(self, clear_stage_root): + def test_get_stage_root_empty(self, clear_stage_root, monkeypatch, tmpdir): + expected = str(tmpdir) + monkeypatch.setattr(spack.stage, "_default_stage_config", [expected]) # build stage set to empty by user is respected and errors with spack.config.override("config:build_stage::", []): with pytest.raises(spack.stage.StageError): spack.stage.get_stage_root() # No build stage set (config section set to empty) uses default - expected = spack.stage._resolve_paths(spack.stage._default_stage_config)[0] with spack.config.override("config::", {}): assert spack.stage.get_stage_root() == expected