gh-121200: Log pwd entry in test_expanduser_pwd2() (#121207)

Use subTest() to log the pwd entry in test_expanduser_pwd2() of
test_posixpath to help debugging.
This commit is contained in:
Victor Stinner 2024-07-01 11:43:59 +02:00 committed by GitHub
parent c766ad206e
commit 05a6f8da60
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 7 additions and 6 deletions

View File

@ -359,10 +359,11 @@ class PosixPathTest(unittest.TestCase):
"no home directory on VxWorks")
def test_expanduser_pwd2(self):
pwd = import_helper.import_module('pwd')
for e in pwd.getpwall():
name = e.pw_name
home = e.pw_dir
for entry in pwd.getpwall():
name = entry.pw_name
home = entry.pw_dir
home = home.rstrip('/') or '/'
with self.subTest(pwd=entry):
self.assertEqual(posixpath.expanduser('~' + name), home)
self.assertEqual(posixpath.expanduser(os.fsencode('~' + name)),
os.fsencode(home))