From cb615e6abe1ae6523aacddbf108fbf92f26e9eb8 Mon Sep 17 00:00:00 2001 From: Ronald Oussoren Date: Sat, 24 Jul 2010 14:15:19 +0000 Subject: 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 | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Lib/test/test_posix.py b/Lib/test/test_posix.py index 6708aeb..b6322b4 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): -- cgit v0.12