From 61055d9ee50679e1c4e05d734b530ae9624c858e Mon Sep 17 00:00:00 2001 From: Harmen Stoppels Date: Wed, 22 Nov 2023 22:30:49 +0100 Subject: test_which: do not mutate os.environ --- lib/spack/spack/test/util/executable.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/spack/spack/test/util/executable.py b/lib/spack/spack/test/util/executable.py index 839cf04bfb..9c49445aab 100644 --- a/lib/spack/spack/test/util/executable.py +++ b/lib/spack/spack/test/util/executable.py @@ -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): -- cgit v1.2.3-70-g09d2