summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_posixpath.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_posixpath.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_posixpath.py')
-rw-r--r--Lib/test/test_posixpath.py7
1 files changed, 3 insertions, 4 deletions
diff --git a/Lib/test/test_posixpath.py b/Lib/test/test_posixpath.py
index 7de94e7..17be3d2 100644
--- a/Lib/test/test_posixpath.py
+++ b/Lib/test/test_posixpath.py
@@ -419,10 +419,9 @@ class PosixPathTest(unittest.TestCase):
self.assert_(isinstance(posixpath.expanduser(b"~root/"), bytes))
self.assert_(isinstance(posixpath.expanduser(b"~foo/"), bytes))
- 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)