]> granicus.if.org Git - python/commitdiff
skip NIS entries, empty entries, etc
authorFredrik Lundh <fredrik@pythonware.com>
Mon, 12 Dec 2005 20:53:40 +0000 (20:53 +0000)
committerFredrik Lundh <fredrik@pythonware.com>
Mon, 12 Dec 2005 20:53:40 +0000 (20:53 +0000)
Lib/test/test_grp.py
Lib/test/test_pwd.py

index f7d219175a6b7d0550d6cb1b2f52baa2346fbdc1..2c3ab296a8b765d053d69498f80e170331da9b5c 100755 (executable)
@@ -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
 
index 69d88dde6934d3520c4262d884ea9b46d9dcfc11..12d2bc9911ab0356c8cdff81e0abf8b59caa36aa 100644 (file)
@@ -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])