From 30da0ea1243955e7f2ab1c85f45e2c20ae1f3c56 Mon Sep 17 00:00:00 2001 From: Guido van Rossum Date: Mon, 15 Dec 1997 14:57:19 +0000 Subject: Believe it or not, some people have an empty group database. Prevent the test from failing there. --- Lib/test/test_grp.py | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/Lib/test/test_grp.py b/Lib/test/test_grp.py index 458ed38..f39049f 100755 --- a/Lib/test/test_grp.py +++ b/Lib/test/test_grp.py @@ -12,11 +12,14 @@ if verbose: for group in groups: print group +if not groups: + if verbose: + print "Empty Group Database -- no further tests of grp module possible" +else: + group = grp.getgrgid(groups[0][2]) + if verbose: + print 'Group Entry for GID %d: %s' % (groups[0][2], group) -group = grp.getgrgid(groups[0][2]) -if verbose: - print 'Group Entry for GID %d: %s' % (groups[0][2], group) - -group = grp.getgrnam(groups[0][0]) -if verbose: - print 'Group Entry for group %s: %s' % (groups[0][0], group) + group = grp.getgrnam(groups[0][0]) + if verbose: + print 'Group Entry for group %s: %s' % (groups[0][0], group) -- cgit v0.12