diff options
author | Guido van Rossum <guido@python.org> | 1997-12-15 14:57:19 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1997-12-15 14:57:19 (GMT) |
commit | 30da0ea1243955e7f2ab1c85f45e2c20ae1f3c56 (patch) | |
tree | 40481af0e38071a58aff10e1d51890d5d1d0713a /Lib/test | |
parent | 095f35ad60adf9e61032d1e82e772e19541d7168 (diff) | |
download | cpython-30da0ea1243955e7f2ab1c85f45e2c20ae1f3c56.zip cpython-30da0ea1243955e7f2ab1c85f45e2c20ae1f3c56.tar.gz cpython-30da0ea1243955e7f2ab1c85f45e2c20ae1f3c56.tar.bz2 |
Believe it or not, some people have an empty group database.
Prevent the test from failing there.
Diffstat (limited to 'Lib/test')
-rwxr-xr-x | Lib/test/test_grp.py | 17 |
1 files 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) |