mirror of
https://github.com/python/cpython.git
synced 2025-09-26 18:29:57 +00:00
Merged revisions 84492 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k ........ r84492 | antoine.pitrou | 2010-09-04 19:32:06 +0200 (sam., 04 sept. 2010) | 4 lines Issue #9581: Fix non-working PosixGroupsTester test case (it only runs as root, which is why nobody bothered about the failure) ........
This commit is contained in:
parent
037077fe03
commit
5c78edae51
1 changed files with 2 additions and 8 deletions
|
@ -310,13 +310,7 @@ class PosixGroupsTester(unittest.TestCase):
|
||||||
def test_initgroups(self):
|
def test_initgroups(self):
|
||||||
# find missing group
|
# find missing group
|
||||||
|
|
||||||
groups = sorted(self.saved_groups)
|
g = max(self.saved_groups) + 1
|
||||||
for g1,g2 in zip(groups[:-1], groups[1:]):
|
|
||||||
g = g1 + 1
|
|
||||||
if g < g2:
|
|
||||||
break
|
|
||||||
else:
|
|
||||||
g = g2 + 1
|
|
||||||
name = pwd.getpwuid(posix.getuid()).pw_name
|
name = pwd.getpwuid(posix.getuid()).pw_name
|
||||||
posix.initgroups(name, g)
|
posix.initgroups(name, g)
|
||||||
self.assertIn(g, posix.getgroups())
|
self.assertIn(g, posix.getgroups())
|
||||||
|
@ -324,7 +318,7 @@ class PosixGroupsTester(unittest.TestCase):
|
||||||
@unittest.skipUnless(hasattr(posix, 'setgroups'),
|
@unittest.skipUnless(hasattr(posix, 'setgroups'),
|
||||||
"test needs posix.setgroups()")
|
"test needs posix.setgroups()")
|
||||||
def test_setgroups(self):
|
def test_setgroups(self):
|
||||||
for groups in [[0], range(16)]:
|
for groups in [[0], list(range(16))]:
|
||||||
posix.setgroups(groups)
|
posix.setgroups(groups)
|
||||||
self.assertListEqual(groups, posix.getgroups())
|
self.assertListEqual(groups, posix.getgroups())
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue