Skip to content

Commit

Permalink
test_which: do not mutate os.environ
Browse files Browse the repository at this point in the history
  • Loading branch information
haampie authored and climbfuji committed Dec 8, 2023
1 parent 2cf6f32 commit 612edaa
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/spack/spack/test/util/executable.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,8 @@ def test_which_with_slash_ignores_path(tmpdir, working_env):
assert exe.path == path


def test_which(tmpdir):
os.environ["PATH"] = str(tmpdir)
def test_which(tmpdir, monkeypatch):
monkeypatch.setenv("PATH", str(tmpdir))
assert ex.which("spack-test-exe") is None

with pytest.raises(ex.CommandNotFoundError):
Expand Down

0 comments on commit 612edaa

Please sign in to comment.