[pypy-svn] pypy default: added tests for getgroups
berdario
commits-noreply at bitbucket.org
Mon Jan 24 14:38:04 CET 2011
Author: Dario Bertini <berdario at gmail.com>
Branch:
Changeset: r41258:ca0f70b3b721
Date: 2011-01-24 13:32 +0100
http://bitbucket.org/pypy/pypy/changeset/ca0f70b3b721/
Log: added tests for getgroups
diff --git a/pypy/module/posix/test/test_posix2.py b/pypy/module/posix/test/test_posix2.py
--- a/pypy/module/posix/test/test_posix2.py
+++ b/pypy/module/posix/test/test_posix2.py
@@ -55,6 +55,8 @@
cls.w_geteuid = space.wrap(os.geteuid())
if hasattr(os, 'getgid'):
cls.w_getgid = space.wrap(os.getgid())
+ if hasattr(os, 'getgroups'):
+ cls.w_getgroups = space.newlist([space.wrap(e) for e in os.getgroups()])
if hasattr(os, 'getpgid'):
cls.w_getpgid = space.wrap(os.getpgid(os.getpid()))
if hasattr(os, 'getsid'):
@@ -489,6 +491,11 @@
def test_os_getgid(self):
os = self.posix
assert os.getgid() == self.getgid
+
+ if hasattr(os, 'getgroups'):
+ def test_os_getgroups(self):
+ os = self.posix
+ assert os.getgroups() == self.getgroups
if hasattr(os, 'getpgid'):
def test_os_getpgid(self):
diff --git a/pypy/rpython/module/test/test_posix.py b/pypy/rpython/module/test/test_posix.py
--- a/pypy/rpython/module/test/test_posix.py
+++ b/pypy/rpython/module/test/test_posix.py
@@ -149,7 +149,12 @@
def f():
return os.getgid()
assert self.interpret(f, []) == f()
-
+
+ if hasattr(os, 'getgroups'):
+ def test_getgroups(self):
+ def f():
+ return os.getgroups()
+ assert self.interpret(f, []) == f()
if hasattr(os, 'setuid'):
def test_os_setuid(self):
More information about the Pypy-commit
mailing list