]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Issue #10822: Fix test_posix:test_getgroups failure under Solaris. Patch
authorAntoine Pitrou <solipsis@pitrou.net>
Wed, 12 Jan 2011 18:45:27 +0000 (18:45 +0000)
committerAntoine Pitrou <solipsis@pitrou.net>
Wed, 12 Jan 2011 18:45:27 +0000 (18:45 +0000)
by Ross Lagerwall.

Lib/test/test_posix.py
Misc/NEWS

index f9f9fcec6aa5a9aa3ccb561817ade884a772e4ea..45b3afc72d9712fa9391825cc851996552049fd5 100644 (file)
@@ -373,6 +373,7 @@ class PosixTester(unittest.TestCase):
                 os.chdir(curdir)
                 support.rmtree(base_path)
 
+    @unittest.skipUnless(hasattr(os, 'getegid'), "test needs os.getegid()")
     def test_getgroups(self):
         with os.popen('id -G') as idg:
             groups = idg.read().strip()
@@ -382,9 +383,11 @@ class PosixTester(unittest.TestCase):
 
         # 'id -G' and 'os.getgroups()' should return the same
         # groups, ignoring order and duplicates.
+        # #10822 - it is implementation defined whether posix.getgroups()
+        # includes the effective gid so we include it anyway, since id -G does
         self.assertEqual(
                 set([int(x) for x in groups.split()]),
-                set(posix.getgroups()))
+                set(posix.getgroups() + [posix.getegid()]))
 
 class PosixGroupsTester(unittest.TestCase):
 
index ee69f507db32fdcebaac4fca71a7022e5df8182e..406c8d04ae967199294c89694207c40b0c7c425b 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -223,6 +223,9 @@ Tools/Demos
 Tests
 -----
 
+- Issue #10822: Fix test_posix:test_getgroups failure under Solaris.  Patch
+  by Ross Lagerwall.
+
 - Make the --coverage flag work for test.regrtest.
 
 - Issue #1677694: Refactor and improve test_timeout.  Original patch by