]> granicus.if.org Git - python/commitdiff
test_getgroups as introduced with issue7900 failed on systems
authorRonald Oussoren <ronaldoussoren@mac.com>
Sun, 1 Aug 2010 19:18:13 +0000 (19:18 +0000)
committerRonald Oussoren <ronaldoussoren@mac.com>
Sun, 1 Aug 2010 19:18:13 +0000 (19:18 +0000)
where 'id -G' and posix.getgroups() returned the same information,
but one of the sources contains duplicate information. Rewrite the
check using sets instead of lists.

Lib/test/test_posix.py

index b6322b4137f951be6256838a9c8974e3bbf9440e..a22ebdf7c71c2d566748124fa0843925cf0ad9e3 100644 (file)
@@ -357,11 +357,11 @@ class PosixTester(unittest.TestCase):
         if not groups:
             raise unittest.SkipTest("need working 'id -G'")
 
-        # The order of groups isn't important, hence the calls
-        # to sorted.
+        # 'id -G' and 'os.getgroups()' should return the same
+        # groups, ignoring order and duplicates.
         self.assertEqual(
-                list(sorted([int(x) for x in groups.split()])),
-                list(sorted(posix.getgroups())))
+                set([int(x) for x in groups.split()]),
+                set(posix.getgroups()))
 
 class PosixGroupsTester(unittest.TestCase):