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.
This commit is contained in:
Ronald Oussoren 2010-08-01 19:18:13 +00:00
parent f5b204a3f0
commit 7fb6f5121a
1 changed files with 4 additions and 4 deletions

View File

@ -357,11 +357,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):