summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorRoss Lagerwall <rosslagerwall@gmail.com>2012-12-13 15:21:16 (GMT)
committerRoss Lagerwall <rosslagerwall@gmail.com>2012-12-13 15:21:16 (GMT)
commit174bc1e309b5bde8602568f186f53d886aec757c (patch)
tree2c9b4aa6f9579ba294f367e79dc0eefe9876f3e7 /Lib
parent57b667261ca9a3834ae68e0398b1d4cea3d61308 (diff)
parenta0b315f5f77ce2e68df4ca8d6174a266592b2c49 (diff)
downloadcpython-174bc1e309b5bde8602568f186f53d886aec757c.zip
cpython-174bc1e309b5bde8602568f186f53d886aec757c.tar.gz
cpython-174bc1e309b5bde8602568f186f53d886aec757c.tar.bz2
Merge with 3.3 for #16661
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/test_posix.py13
1 files changed, 3 insertions, 10 deletions
diff --git a/Lib/test/test_posix.py b/Lib/test/test_posix.py
index f59607b..4ad7350 100644
--- a/Lib/test/test_posix.py
+++ b/Lib/test/test_posix.py
@@ -647,17 +647,10 @@ class PosixTester(unittest.TestCase):
@unittest.skipUnless(hasattr(pwd, 'getpwuid'), "test needs pwd.getpwuid()")
@unittest.skipUnless(hasattr(os, 'getuid'), "test needs os.getuid()")
def test_getgrouplist(self):
- with os.popen('id -G') as idg:
- groups = idg.read().strip()
- ret = idg.close()
+ user = pwd.getpwuid(os.getuid())[0]
+ group = pwd.getpwuid(os.getuid())[3]
+ self.assertIn(group, posix.getgrouplist(user, group))
- if ret is not None or not groups:
- raise unittest.SkipTest("need working 'id -G'")
-
- self.assertEqual(
- set([int(x) for x in groups.split()]),
- set(posix.getgrouplist(pwd.getpwuid(os.getuid())[0],
- pwd.getpwuid(os.getuid())[3])))
@unittest.skipUnless(hasattr(os, 'getegid'), "test needs os.getegid()")
def test_getgroups(self):