Backport r60208, skip some tests for huge passwd/group files.

This commit is contained in:
Guido van Rossum 2008-01-23 01:20:26 +00:00
parent 7bf216b034
commit 2c63442586
2 changed files with 6 additions and 0 deletions

View File

@ -25,6 +25,9 @@ class GroupDatabaseTestCase(unittest.TestCase):
for e in entries: for e in entries:
self.check_value(e) self.check_value(e)
if len(entries) > 1000: # Huge group file (NIS?) -- skip the rest
return
for e in entries: for e in entries:
e2 = grp.getgrgid(e.gr_gid) e2 = grp.getgrgid(e.gr_gid)
self.check_value(e2) self.check_value(e2)

View File

@ -35,6 +35,9 @@ class PwdTest(unittest.TestCase):
entriesbyname.setdefault(e.pw_name, []).append(e) entriesbyname.setdefault(e.pw_name, []).append(e)
entriesbyuid.setdefault(e.pw_uid, []).append(e) entriesbyuid.setdefault(e.pw_uid, []).append(e)
if len(entries) > 1000: # Huge passwd file (NIS?) -- skip the rest
return
# check whether the entry returned by getpwuid() # check whether the entry returned by getpwuid()
# for each uid is among those from getpwall() for this uid # for each uid is among those from getpwall() for this uid
for e in entries: for e in entries: