tests: refactor for robustness, avoid dependence on path parsing
This commit is contained in:
parent
0df5b8616c
commit
55cc228307
@ -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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user