Skip to content

Commit

Permalink
tests/bugfix: Use config fixture for stage tests
Browse files Browse the repository at this point in the history
Some tests introduced in spack#11528 temporarily set the user's `config:build_stage`, which affected (or created) a config.yaml file in the user's `$HOME/.spack` directory that could leave entries behind if the tests fail.

This change ensures only temporary configuration files are used/affected by these tests.
  • Loading branch information
tldahlgren committed Jun 13, 2019
1 parent 25b21c0 commit 1d952f6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion lib/spack/spack/stage.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def get_tmp_root():

path = _first_accessible_path(candidates)
if not path:
raise StageError("No accessible stage paths in %s", candidates)
raise StageError("No accessible stage paths in:", candidates)

# Return None to indicate we're using a local staging area.
if path == canonicalize_path(spack.paths.stage_path):
Expand Down
10 changes: 5 additions & 5 deletions lib/spack/spack/test/stage.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ def no_tmp_root_stage(monkeypatch):


@pytest.fixture
def non_user_path_for_stage():
def non_user_path_for_stage(config):
"""
Use a non-user path for staging.
Expand All @@ -206,7 +206,7 @@ def non_user_path_for_stage():


@pytest.fixture
def stage_path_for_stage():
def stage_path_for_stage(config):
"""
Use the basic stage_path for staging.
Expand All @@ -221,7 +221,7 @@ def stage_path_for_stage():


@pytest.fixture
def tmp_path_for_stage(tmpdir):
def tmp_path_for_stage(tmpdir, config):
"""
Use a built-in, temporary, test directory for staging.
Expand All @@ -248,7 +248,7 @@ def tmp_root_stage(monkeypatch):


@pytest.fixture
def tmpdir_for_stage(mock_stage_archive):
def tmpdir_for_stage(config, mock_stage_archive):
"""
Use the mock_stage_archive's temporary directory for staging.
Expand All @@ -266,7 +266,7 @@ def tmpdir_for_stage(mock_stage_archive):


@pytest.fixture
def tmp_build_stage_dir(tmpdir):
def tmp_build_stage_dir(tmpdir, config):
"""Establish the temporary build_stage for the mock archive."""
test_tmp_path = tmpdir.join('tmp')

Expand Down

0 comments on commit 1d952f6

Please sign in to comment.