]> granicus.if.org Git - python/commitdiff
Merged revisions 83133 via svnmerge from
authorRonald Oussoren <ronaldoussoren@mac.com>
Sat, 24 Jul 2010 14:21:29 +0000 (14:21 +0000)
committerRonald Oussoren <ronaldoussoren@mac.com>
Sat, 24 Jul 2010 14:21:29 +0000 (14:21 +0000)
svn+ssh://pythondev@svn.python.org/python/branches/py3k

........
  r83133 | ronald.oussoren | 2010-07-24 15:15:19 +0100 (Sat, 24 Jul 2010) | 5 lines

  Fix for issue 9367: the test code for os.getgroups
  assumes that the result of getgroups and the output
  of the id(1) command return groups in the same
  order.  That assumption is both fragile and false.
........

Lib/test/test_posix.py

index 3f6e11bb3638eb39765691ad4a52cdfb280569b0..e069bf8f51ad5cd5eaf72b8a90592bfe89e4ee63 100644 (file)
@@ -371,7 +371,11 @@ class PosixTester(unittest.TestCase):
         if not groups:
             raise unittest.SkipTest("need working 'id -G'")
 
-        self.assertEqual([int(x) for x in groups.split()], posix.getgroups())
+        # The order of groups isn't important, hence the calls
+        # to sorted.
+        self.assertEqual(
+                list(sorted([int(x) for x in groups.split()])),
+                list(sorted(posix.getgroups())))
 
 class PosixGroupsTester(unittest.TestCase):