https://github.com/python/cpython/commit/776573c9f08f70ae9cb2327a905a42f265b331a6
commit: 776573c9f08f70ae9cb2327a905a42f265b331a6
branch: main
author: Victor Stinner <[email protected]>
committer: vstinner <[email protected]>
date: 2026-05-26T21:16:16Z
summary:

gh-149879: Fix test_grp on Cygwin (#150495)

files:
M Lib/test/test_grp.py

diff --git a/Lib/test/test_grp.py b/Lib/test/test_grp.py
index ed86802f069e0f..f08b9328a9ff04 100644
--- a/Lib/test/test_grp.py
+++ b/Lib/test/test_grp.py
@@ -2,6 +2,7 @@
 
 import random
 import string
+import sys
 import unittest
 from test.support import import_helper
 
@@ -35,7 +36,15 @@ def test_values_extended(self):
             self.skipTest('huge group file, extended test skipped')
 
         for e in entries:
-            e2 = grp.getgrgid(e.gr_gid)
+            try:
+                e2 = grp.getgrgid(e.gr_gid)
+            except KeyError:
+                # On Cygwin, some groups returned by getgrall() cannot be
+                # retrieved by getgrgid()
+                if sys.platform == 'cygwin':
+                    continue
+                raise
+
             self.check_value(e2)
             self.assertEqual(e2.gr_gid, e.gr_gid)
             name = e.gr_name

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]

Reply via email to