summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorHarmen Stoppels <harmenstoppels@gmail.com>2023-11-22 22:30:49 +0100
committerTodd Gamblin <tgamblin@llnl.gov>2023-11-22 14:22:37 -0800
commit61055d9ee50679e1c4e05d734b530ae9624c858e (patch)
treeffa0333054b39a9ba042cdb8670094f4fb3a9ab7 /lib
parentc1a8bb2a1280b3fcb1487f3de8781c1b181130c6 (diff)
downloadspack-61055d9ee50679e1c4e05d734b530ae9624c858e.tar.gz
spack-61055d9ee50679e1c4e05d734b530ae9624c858e.tar.bz2
spack-61055d9ee50679e1c4e05d734b530ae9624c858e.tar.xz
spack-61055d9ee50679e1c4e05d734b530ae9624c858e.zip
test_which: do not mutate os.environ
Diffstat (limited to 'lib')
-rw-r--r--lib/spack/spack/test/util/executable.py4
1 files changed, 2 insertions, 2 deletions
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):