diff options
author | Walter Dörwald <walter@livinglogic.de> | 2009-04-26 21:04:55 +0000 |
---|---|---|
committer | Walter Dörwald <walter@livinglogic.de> | 2009-04-26 21:04:55 +0000 |
commit | 536120e34d792ae77c7415197b5186a16af7872d (patch) | |
tree | 94c3de0b409e355a0febef65bd6a63a6192d0f6b /Lib/test/test_tempfile.py | |
parent | 9a0517c2cc84b5065a28b089aa209c35d34b6b87 (diff) | |
download | cpython-git-536120e34d792ae77c7415197b5186a16af7872d.tar.gz |
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.py | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/Lib/test/test_tempfile.py b/Lib/test/test_tempfile.py index 74e55d80f5..1f98cf8642 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) |