]> granicus.if.org Git - python/commitdiff
Merged revisions 83431 via svnmerge from
authorRonald Oussoren <ronaldoussoren@mac.com>
Tue, 3 Aug 2010 07:31:12 +0000 (07:31 +0000)
committerRonald Oussoren <ronaldoussoren@mac.com>
Tue, 3 Aug 2010 07:31:12 +0000 (07:31 +0000)
svn+ssh://pythondev@svn.python.org/python/branches/py3k

........
  r83431 | ronald.oussoren | 2010-08-01 21:18:13 +0200 (Sun, 01 Aug 2010) | 6 lines

  test_getgroups as introduced with issue7900 failed on systems
  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 e069bf8f51ad5cd5eaf72b8a90592bfe89e4ee63..e7d008472fa7d1e2bdbfb8dc3a328450fe476c17 100644 (file)
@@ -371,11 +371,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):