]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-121200: Log pwd entry in test_expanduser_pwd2() (#121207)
authorVictor Stinner <vstinner@python.org>
Mon, 1 Jul 2024 09:43:59 +0000 (11:43 +0200)
committerGitHub <noreply@github.com>
Mon, 1 Jul 2024 09:43:59 +0000 (11:43 +0200)
Use subTest() to log the pwd entry in test_expanduser_pwd2() of
test_posixpath to help debugging.

Lib/test/test_posixpath.py

index 57a24e9c70d5e543b35b7a6463d233d7030db374..9f36a4cd9ce43f7b47ebf7eee9d1cacd99f416b6 100644 (file)
@@ -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 = [
         ("", "."),