diff options
author | Walter Dörwald <walter@livinglogic.de> | 2009-04-26 20:51:44 +0000 |
---|---|---|
committer | Walter Dörwald <walter@livinglogic.de> | 2009-04-26 20:51:44 +0000 |
commit | 4b965f6ab17370b06ee587c7b12ad3bcd96163e3 (patch) | |
tree | f0b91e2341aac4251161bf630770740bd0b4c8af /Lib/test/test_posixpath.py | |
parent | e73cbe7a4eba3498f03e8cd27248affcd99e1d74 (diff) | |
download | cpython-git-4b965f6ab17370b06ee587c7b12ad3bcd96163e3.tar.gz |
Use test.test_support.EnvironmentVarGuard where tests change environment vars.
Diffstat (limited to 'Lib/test/test_posixpath.py')
-rw-r--r-- | Lib/test/test_posixpath.py | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/Lib/test/test_posixpath.py b/Lib/test/test_posixpath.py index e6f750a0c2..b7fbd50dbb 100644 --- a/Lib/test/test_posixpath.py +++ b/Lib/test/test_posixpath.py @@ -345,10 +345,9 @@ class PosixPathTest(unittest.TestCase): self.assert_(isinstance(posixpath.expanduser("~root/"), basestring)) self.assert_(isinstance(posixpath.expanduser("~foo/"), basestring)) - orig_home = os.environ['HOME'] - os.environ['HOME'] = '/' - self.assertEqual(posixpath.expanduser("~"), "/") - os.environ['HOME'] = orig_home + with test_support.EnvironmentVarGuard() as env: + env.set('HOME', '/') + self.assertEqual(posixpath.expanduser("~"), "/") self.assertRaises(TypeError, posixpath.expanduser) |