summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRonald Oussoren <ronaldoussoren@mac.com>2010-08-01 19:18:13 (GMT)
committerRonald Oussoren <ronaldoussoren@mac.com>2010-08-01 19:18:13 (GMT)
commit7fb6f5121a42136f35c561c408091cd043f6340d (patch)
treef059f2de677d0ce4875ed14cb8614f5260fb39e9
parentf5b204a3f0e55c6381822698c4afd85733c83a0f (diff)
downloadcpython-7fb6f5121a42136f35c561c408091cd043f6340d.zip
cpython-7fb6f5121a42136f35c561c408091cd043f6340d.tar.gz
cpython-7fb6f5121a42136f35c561c408091cd043f6340d.tar.bz2
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.
-rw-r--r--Lib/test/test_posix.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/Lib/test/test_posix.py b/Lib/test/test_posix.py
index b6322b4..a22ebdf 100644
--- a/Lib/test/test_posix.py
+++ b/Lib/test/test_posix.py
@@ -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):