summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2024-07-01 10:09:01 (GMT)
committerGitHub <noreply@github.com>2024-07-01 10:09:01 (GMT)
commit7bd67d56c4fea7a9cbbd1282704f083e5ecf418b (patch)
tree45ed6dfc75ca676a1bc030fa02868e5f32680078 /Lib/test
parent178b5b16d38ba08daa1037920fea274975ac830d (diff)
downloadcpython-7bd67d56c4fea7a9cbbd1282704f083e5ecf418b.zip
cpython-7bd67d56c4fea7a9cbbd1282704f083e5ecf418b.tar.gz
cpython-7bd67d56c4fea7a9cbbd1282704f083e5ecf418b.tar.bz2
[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 05a6f8da6042cc87da1cd3824c1375d12753e5a1) Co-authored-by: Victor Stinner <vstinner@python.org>
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/test_posixpath.py13
1 files changed, 7 insertions, 6 deletions
diff --git a/Lib/test/test_posixpath.py b/Lib/test/test_posixpath.py
index 57a24e9..9f36a4c 100644
--- a/Lib/test/test_posixpath.py
+++ b/Lib/test/test_posixpath.py
@@ -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 = [
("", "."),