Believe it or not, some people have an empty group database.

Prevent the test from failing there.
This commit is contained in:
Guido van Rossum 1997-12-15 14:57:19 +00:00
parent 095f35ad60
commit 30da0ea124
1 changed files with 10 additions and 7 deletions

View File

@ -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)