diff options
author | Collin Winter <collinw@gmail.com> | 2010-03-18 00:23:44 (GMT) |
---|---|---|
committer | Collin Winter <collinw@gmail.com> | 2010-03-18 00:23:44 (GMT) |
commit | b24ef1963d737e25882a0e0feb305ece1ecbed29 (patch) | |
tree | e6c52e6080294a159085f9f07336807bfebf6e63 | |
parent | 8641c562e3ba5378bb17f4d00bace84bab629c00 (diff) | |
download | cpython-b24ef1963d737e25882a0e0feb305ece1ecbed29.zip cpython-b24ef1963d737e25882a0e0feb305ece1ecbed29.tar.gz cpython-b24ef1963d737e25882a0e0feb305ece1ecbed29.tar.bz2 |
Merged revisions 79044 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r79044 | collin.winter | 2010-03-17 17:10:34 -0700 (Wed, 17 Mar 2010) | 1 line
Make test_pwd more stable in the face of unusual LDAP/NIS/Kerberos deployments (the old test was flaky on Google buildslaves).
........
-rw-r--r-- | Lib/test/test_pwd.py | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/Lib/test/test_pwd.py b/Lib/test/test_pwd.py index 95058c0..ae1c8fe 100644 --- a/Lib/test/test_pwd.py +++ b/Lib/test/test_pwd.py @@ -1,3 +1,4 @@ +import sys import unittest from test import support @@ -83,11 +84,13 @@ class PwdTest(unittest.TestCase): self.assertRaises(KeyError, pwd.getpwnam, fakename) - # Choose a non-existent uid. - fakeuid = 4127 - while fakeuid in byuids: - fakeuid = (fakeuid * 3) % 0x10000 - + # In some cases, byuids isn't a complete list of all users in the + # system, so if we try to pick a value not in byuids (via a perturbing + # loop, say), pwd.getpwuid() might still be able to find data for that + # uid. Using sys.maxint may provoke the same problems, but hopefully + # it will be a more repeatable failure. + fakeuid = sys.maxsize + self.assertNotIn(fakeuid, byuids) self.assertRaises(KeyError, pwd.getpwuid, fakeuid) def test_main(): |