MERGE: Closes #14768: os.path.expanduser('~/a') doesn't works correctly when HOME is '/'

This commit is contained in:
Jesus Cea 2012-05-10 05:16:41 +02:00
commit b58ab2c6aa
4 changed files with 6 additions and 2 deletions

View file

@ -300,6 +300,7 @@ class PosixPathTest(unittest.TestCase):
with support.EnvironmentVarGuard() as env:
env['HOME'] = '/'
self.assertEqual(posixpath.expanduser("~"), "/")
self.assertEqual(posixpath.expanduser("~/foo"), "/foo")
# expanduser should fall back to using the password database
del env['HOME']
home = pwd.getpwuid(os.getuid()).pw_dir