summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_posix.py
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2010-09-04 17:32:06 (GMT)
committerAntoine Pitrou <solipsis@pitrou.net>2010-09-04 17:32:06 (GMT)
commite5a9101519ded4efc38611d2f93594f3fe04147f (patch)
tree9b4d60a0471b0a14efe9ad960ffca1fb4a0a66f6 /Lib/test/test_posix.py
parentd3ccde8a21755046cdb3f73fb11e46d1043dc076 (diff)
downloadcpython-e5a9101519ded4efc38611d2f93594f3fe04147f.zip
cpython-e5a9101519ded4efc38611d2f93594f3fe04147f.tar.gz
cpython-e5a9101519ded4efc38611d2f93594f3fe04147f.tar.bz2
Issue #9581: Fix non-working PosixGroupsTester test case
(it only runs as root, which is why nobody bothered about the failure)
Diffstat (limited to 'Lib/test/test_posix.py')
-rw-r--r--Lib/test/test_posix.py10
1 files changed, 2 insertions, 8 deletions
diff --git a/Lib/test/test_posix.py b/Lib/test/test_posix.py
index b0d7fce..902d16a 100644
--- a/Lib/test/test_posix.py
+++ b/Lib/test/test_posix.py
@@ -409,13 +409,7 @@ class PosixGroupsTester(unittest.TestCase):
def test_initgroups(self):
# find missing group
- groups = sorted(self.saved_groups)
- for g1,g2 in zip(groups[:-1], groups[1:]):
- g = g1 + 1
- if g < g2:
- break
- else:
- g = g2 + 1
+ g = max(self.saved_groups) + 1
name = pwd.getpwuid(posix.getuid()).pw_name
posix.initgroups(name, g)
self.assertIn(g, posix.getgroups())
@@ -423,7 +417,7 @@ class PosixGroupsTester(unittest.TestCase):
@unittest.skipUnless(hasattr(posix, 'setgroups'),
"test needs posix.setgroups()")
def test_setgroups(self):
- for groups in [[0], range(16)]:
+ for groups in [[0], list(range(16))]:
posix.setgroups(groups)
self.assertListEqual(groups, posix.getgroups())