diff --git a/Lib/test/test_posix.py b/Lib/test/test_posix.py index e069bf8f51a..e7d008472fa 100644 --- a/Lib/test/test_posix.py +++ b/Lib/test/test_posix.py @@ -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):