Commit 7fb6f512 authored by Ronald Oussoren's avatar Ronald Oussoren

test_getgroups as introduced with issue7900 failed on systems

where 'id -G' and posix.getgroups() returned the same information,
but one of the sources contains duplicate information. Rewrite the
check using sets instead of lists.
parent f5b204a3
...@@ -357,11 +357,11 @@ class PosixTester(unittest.TestCase): ...@@ -357,11 +357,11 @@ class PosixTester(unittest.TestCase):
if not groups: if not groups:
raise unittest.SkipTest("need working 'id -G'") raise unittest.SkipTest("need working 'id -G'")
# The order of groups isn't important, hence the calls # 'id -G' and 'os.getgroups()' should return the same
# to sorted. # groups, ignoring order and duplicates.
self.assertEqual( self.assertEqual(
list(sorted([int(x) for x in groups.split()])), set([int(x) for x in groups.split()]),
list(sorted(posix.getgroups()))) set(posix.getgroups()))
class PosixGroupsTester(unittest.TestCase): class PosixGroupsTester(unittest.TestCase):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment