summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_grp.py
diff options
context:
space:
mode:
authorWalter Dörwald <walter@livinglogic.de>2003-05-05 20:37:33 (GMT)
committerWalter Dörwald <walter@livinglogic.de>2003-05-05 20:37:33 (GMT)
commitce6829ade0071e5463a5dc5cde7bbb01667073d5 (patch)
treebd303cf19d9fc2ace89f588dee2f45e238439c5c /Lib/test/test_grp.py
parent6cb52ddc3c34f08ddc3857dc10194a2f6653aaec (diff)
downloadcpython-ce6829ade0071e5463a5dc5cde7bbb01667073d5.zip
cpython-ce6829ade0071e5463a5dc5cde7bbb01667073d5.tar.gz
cpython-ce6829ade0071e5463a5dc5cde7bbb01667073d5.tar.bz2
On Mac OS X pwd.getpwall() might return the tuples
('pgsql', '*', 252, []) and ('postgres', '*', 252, ['skip']), but pwd.getgrgid(252) might return ('pgsql', '', 252, ['skip']). Drop the test that tried to find a tuple similar to the one returned from pwd.getgrgid() among those for the same gid returned by pwd.getgrall(), as the only working definition of 'similar' seems to be 'has the same gid'. This check can be done more directly. This should fix SF bug #732783.
Diffstat (limited to 'Lib/test/test_grp.py')
-rwxr-xr-xLib/test/test_grp.py23
1 files changed, 2 insertions, 21 deletions
diff --git a/Lib/test/test_grp.py b/Lib/test/test_grp.py
index 6304d82..f7d2191 100755
--- a/Lib/test/test_grp.py
+++ b/Lib/test/test_grp.py
@@ -19,38 +19,19 @@ class GroupDatabaseTestCase(unittest.TestCase):
self.assertEqual(value[3], value.gr_mem)
self.assert_(isinstance(value.gr_mem, list))
- def valueseq(self, value1, value2):
- # are two grp tuples equal (don't compare passwords)
- return value1.gr_name==value2.gr_name and \
- value1.gr_gid==value2.gr_gid and value1.gr_mem==value2.gr_mem
-
def test_values(self):
entries = grp.getgrall()
- entriesbygid = {}
- entriesbyname = {}
-
- # we can't use the same strategy as in test_pwd, because
- # we can't compare gr_passwd (Mac OS X returns
- # "*" in getgrall() and "" in getgrgid())
for e in entries:
self.check_value(e)
- entriesbygid.setdefault(e.gr_gid, []).append(e)
- entriesbyname.setdefault(e.gr_name, []).append(e)
for e in entries:
e2 = grp.getgrgid(e.gr_gid)
self.check_value(e2)
- # make sure that at least one of the entries
- # for this gid compares equal to e2
- self.assert_(max([self.valueseq(e2, x) \
- for x in entriesbygid[e.gr_gid]]))
+ self.assertEqual(e2.gr_gid, e.gr_gid)
e2 = grp.getgrnam(e.gr_name)
self.check_value(e2)
- # make sure that at least one of the entries
- # for this name compares equal to e2
- self.assert_(max([self.valueseq(e2, x) \
- for x in entriesbyname[e.gr_name]]))
+ self.assertEqual(e2.gr_name, e.gr_name)
def test_errors(self):
self.assertRaises(TypeError, grp.getgrgid)