Skip to content

Commit e2a97d1

Browse files
[3.12] gh-121200: Log pwd entry in test_expanduser_pwd2() (GH-121207) (#121214)
gh-121200: Log pwd entry in test_expanduser_pwd2() (GH-121207) Use subTest() to log the pwd entry in test_expanduser_pwd2() of test_posixpath to help debugging. (cherry picked from commit 05a6f8d) Co-authored-by: Victor Stinner <[email protected]>
1 parent 3fba86e commit e2a97d1

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
@@ -347,13 +347,14 @@ def test_expanduser_pwd(self):
347347
"no home directory on VxWorks")
348348
def test_expanduser_pwd2(self):
349349
pwd = import_helper.import_module('pwd')
350-
for e in pwd.getpwall():
351-
name = e.pw_name
352-
home = e.pw_dir
350+
for entry in pwd.getpwall():
351+
name = entry.pw_name
352+
home = entry.pw_dir
353353
home = home.rstrip('/') or '/'
354-
self.assertEqual(posixpath.expanduser('~' + name), home)
355-
self.assertEqual(posixpath.expanduser(os.fsencode('~' + name)),
356-
os.fsencode(home))
354+
with self.subTest(pwd=entry):
355+
self.assertEqual(posixpath.expanduser('~' + name), home)
356+
self.assertEqual(posixpath.expanduser(os.fsencode('~' + name)),
357+
os.fsencode(home))
357358

358359
NORMPATH_CASES = [
359360
("", "."),

0 commit comments

Comments
 (0)