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.
........
This commit is contained in:
Walter Dörwald 2009-04-26 21:39:21 +00:00
parent 4af362905c
commit b525e18500
6 changed files with 36 additions and 64 deletions

View file

@ -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)