mirror of
https://github.com/python/cpython.git
synced 2025-07-24 19:54:21 +00:00
[3.13] gh-121200: Log pwd entry in test_expanduser_pwd2() (GH-121207) (#121213)
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 05a6f8da60
)
Co-authored-by: Victor Stinner <vstinner@python.org>
This commit is contained in:
parent
178b5b16d3
commit
7bd67d56c4
1 changed files with 7 additions and 6 deletions
|
@ -359,13 +359,14 @@ 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 '/'
|
||||
self.assertEqual(posixpath.expanduser('~' + name), home)
|
||||
self.assertEqual(posixpath.expanduser(os.fsencode('~' + name)),
|
||||
os.fsencode(home))
|
||||
with self.subTest(pwd=entry):
|
||||
self.assertEqual(posixpath.expanduser('~' + name), home)
|
||||
self.assertEqual(posixpath.expanduser(os.fsencode('~' + name)),
|
||||
os.fsencode(home))
|
||||
|
||||
NORMPATH_CASES = [
|
||||
("", "."),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue