summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_tempfile.py
diff options
context:
space:
mode:
authorWalter Dörwald <walter@livinglogic.de>2009-04-26 21:39:21 (GMT)
committerWalter Dörwald <walter@livinglogic.de>2009-04-26 21:39:21 (GMT)
commitb525e18500885731f958bd4a0114f26cea336500 (patch)
treef7ac3daec3d7e870dac64abe27c9166269a124c7 /Lib/test/test_tempfile.py
parent4af362905cb1e8cb56e26a51021de855798227ea (diff)
downloadcpython-b525e18500885731f958bd4a0114f26cea336500.zip
cpython-b525e18500885731f958bd4a0114f26cea336500.tar.gz
cpython-b525e18500885731f958bd4a0114f26cea336500.tar.bz2
Merged revisions 71984 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r71984 | walter.doerwald | 2009-04-26 22:51:44 +0200 (So, 26 Apr 2009) | 2 lines Use test.test_support.EnvironmentVarGuard where tests change environment vars. ........
Diffstat (limited to 'Lib/test/test_tempfile.py')
-rw-r--r--Lib/test/test_tempfile.py9
1 files changed, 2 insertions, 7 deletions
diff --git a/Lib/test/test_tempfile.py b/Lib/test/test_tempfile.py
index 27a2183..844e608 100644
--- a/Lib/test/test_tempfile.py
+++ b/Lib/test/test_tempfile.py
@@ -149,13 +149,11 @@ class test__candidate_tempdir_list(TC):
# _candidate_tempdir_list contains the expected directories
# Make sure the interesting environment variables are all set.
- added = []
- try:
+ with test_support.EnvironmentVarGuard() as env:
for envname in 'TMPDIR', 'TEMP', 'TMP':
dirname = os.getenv(envname)
if not dirname:
- os.environ[envname] = os.path.abspath(envname)
- added.append(envname)
+ env.set(envname, os.path.abspath(envname))
cand = tempfile._candidate_tempdir_list()
@@ -173,9 +171,6 @@ class test__candidate_tempdir_list(TC):
# Not practical to try to verify the presence of OS-specific
# paths in this list.
- finally:
- for p in added:
- del os.environ[p]
test_classes.append(test__candidate_tempdir_list)