From: Fredrik Lundh Date: Mon, 12 Dec 2005 20:53:40 +0000 (+0000) Subject: skip NIS entries, empty entries, etc X-Git-Tag: v2.5a0~1049 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=0e664e15efb87b437402a7e6524d635033b7a91e;p=thirdparty%2FPython%2Fcpython.git skip NIS entries, empty entries, etc --- diff --git a/Lib/test/test_grp.py b/Lib/test/test_grp.py index f7d219175a6b..2c3ab296a8b7 100755 --- a/Lib/test/test_grp.py +++ b/Lib/test/test_grp.py @@ -42,6 +42,8 @@ class GroupDatabaseTestCase(unittest.TestCase): bynames = {} bygids = {} for (n, p, g, mem) in grp.getgrall(): + if not n or n == '+': + continue # skip NIS entries etc. bynames[n] = g bygids[g] = n diff --git a/Lib/test/test_pwd.py b/Lib/test/test_pwd.py index 69d88dde6934..12d2bc9911ab 100644 --- a/Lib/test/test_pwd.py +++ b/Lib/test/test_pwd.py @@ -38,8 +38,8 @@ class PwdTest(unittest.TestCase): # check whether the entry returned by getpwuid() # for each uid is among those from getpwall() for this uid for e in entries: - if e[0] == '+': - continue # skip NIS entries + if not e[0] or e[0] == '+': + continue # skip NIS entries etc. self.assert_(pwd.getpwnam(e.pw_name) in entriesbyname[e.pw_name]) self.assert_(pwd.getpwuid(e.pw_uid) in entriesbyuid[e.pw_uid])