Skip to content

Commit

Permalink
pythongh-118060: Debug test_posixpath.test_expanduser_pwd2()
Browse files Browse the repository at this point in the history
Add context, the pwd entry, when a test fails.
  • Loading branch information
vstinner committed Apr 18, 2024
1 parent 8f25cc9 commit 8650eef
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions Lib/test/test_posixpath.py
Original file line number Diff line number Diff line change
Expand Up @@ -349,12 +349,13 @@ def test_expanduser_pwd(self):
def test_expanduser_pwd2(self):
pwd = import_helper.import_module('pwd')
for e in pwd.getpwall():
name = e.pw_name
home = e.pw_dir
home = home.rstrip('/') or '/'
self.assertEqual(posixpath.expanduser('~' + name), home)
self.assertEqual(posixpath.expanduser(os.fsencode('~' + name)),
os.fsencode(home))
with self.subTest(entry=e):
name = e.pw_name
home = e.pw_dir
home = home.rstrip('/') or '/'
self.assertEqual(posixpath.expanduser('~' + name), home)
self.assertEqual(posixpath.expanduser(os.fsencode('~' + name)),
os.fsencode(home))

NORMPATH_CASES = [
("", "."),
Expand Down

0 comments on commit 8650eef

Please sign in to comment.