Skip to content

Commit 05a6f8d

Browse files
authored
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.
1 parent c766ad2 commit 05a6f8d

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

Lib/test/test_posixpath.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -359,13 +359,14 @@ def test_expanduser_pwd(self):
359359
"no home directory on VxWorks")
360360
def test_expanduser_pwd2(self):
361361
pwd = import_helper.import_module('pwd')
362-
for e in pwd.getpwall():
363-
name = e.pw_name
364-
home = e.pw_dir
362+
for entry in pwd.getpwall():
363+
name = entry.pw_name
364+
home = entry.pw_dir
365365
home = home.rstrip('/') or '/'
366-
self.assertEqual(posixpath.expanduser('~' + name), home)
367-
self.assertEqual(posixpath.expanduser(os.fsencode('~' + name)),
368-
os.fsencode(home))
366+
with self.subTest(pwd=entry):
367+
self.assertEqual(posixpath.expanduser('~' + name), home)
368+
self.assertEqual(posixpath.expanduser(os.fsencode('~' + name)),
369+
os.fsencode(home))
369370

370371
NORMPATH_CASES = [
371372
("", "."),

0 commit comments

Comments
 (0)