Skip to content

Commit 06ff86e

Browse files
committed
gh-121200: Debug test_posixpath.test_expanduser_pwd2()
1 parent 56a3ce2 commit 06ff86e

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

‎Lib/posixpath.py‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,7 @@ def expanduser(path):
266266
name = os.fsdecode(name)
267267
try:
268268
pwent = pwd.getpwnam(name)
269+
print(f"expanduser: {pwent=!r}")
269270
except KeyError:
270271
# bpo-10496: if the user name from the path doesn't exist in the
271272
# password database, return the path unchanged

‎Lib/test/test_posixpath.py‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -361,9 +361,11 @@ def test_expanduser_pwd2(self):
361361
pwd = import_helper.import_module('pwd')
362362
for entry in pwd.getpwall():
363363
name = entry.pw_name
364+
entry2 = pwd.getpwnam(name)
365+
364366
home = entry.pw_dir
365367
home = home.rstrip('/') or '/'
366-
with self.subTest(pwd=entry):
368+
with self.subTest(pwd=entry, entry2=entry2):
367369
self.assertEqual(posixpath.expanduser('~' + name), home)
368370
self.assertEqual(posixpath.expanduser(os.fsencode('~' + name)),
369371
os.fsencode(home))

0 commit comments

Comments
 (0)