summaryrefslogtreecommitdiff
path: root/Lib/test/test_posixpath.py
diff options
context:
space:
mode:
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 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)