summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRonald Oussoren <ronaldoussoren@mac.com>2010-07-24 14:15:19 +0000
committerRonald Oussoren <ronaldoussoren@mac.com>2010-07-24 14:15:19 +0000
commitcb615e6abe1ae6523aacddbf108fbf92f26e9eb8 (patch)
tree7fcff6f0659d776c468bb53d32897f2f002a2980
parent9c71f90329b842c8b9c6b3b2726f5791b00a5c3b (diff)
downloadcpython-git-cb615e6abe1ae6523aacddbf108fbf92f26e9eb8.tar.gz
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.
-rw-r--r--Lib/test/test_posix.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/Lib/test/test_posix.py b/Lib/test/test_posix.py
index 6708aeb896..b6322b4137 100644
--- a/Lib/test/test_posix.py
+++ b/Lib/test/test_posix.py
@@ -357,7 +357,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):