summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1997-12-15 14:57:19 (GMT)
committerGuido van Rossum <guido@python.org>1997-12-15 14:57:19 (GMT)
commit30da0ea1243955e7f2ab1c85f45e2c20ae1f3c56 (patch)
tree40481af0e38071a58aff10e1d51890d5d1d0713a /Lib
parent095f35ad60adf9e61032d1e82e772e19541d7168 (diff)
downloadcpython-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')
-rwxr-xr-xLib/test/test_grp.py17
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)