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.
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):