diff options
author | Antoine Pitrou <solipsis@pitrou.net> | 2010-10-29 18:16:31 (GMT) |
---|---|---|
committer | Antoine Pitrou <solipsis@pitrou.net> | 2010-10-29 18:16:31 (GMT) |
commit | e0e34bbb646ffa16d796230e7bee4a6c29c3e201 (patch) | |
tree | 286eb5575224cec3942402700d5b84131fb3d649 /Lib | |
parent | c6f4024e03230d1e709495b472377ff2d1909a30 (diff) | |
download | cpython-e0e34bbb646ffa16d796230e7bee4a6c29c3e201.zip cpython-e0e34bbb646ffa16d796230e7bee4a6c29c3e201.tar.gz cpython-e0e34bbb646ffa16d796230e7bee4a6c29c3e201.tar.bz2 |
Merged revisions 85931 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k
........
r85931 | antoine.pitrou | 2010-10-29 20:15:33 +0200 (ven., 29 oct. 2010) | 5 lines
Issue #7547: fix transient failures due to network glitches in test_timeout.
Patch by Sandro Tosi.
........
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/test/test_timeout.py | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/Lib/test/test_timeout.py b/Lib/test/test_timeout.py index b67cbc9..bbcdc25 100644 --- a/Lib/test/test_timeout.py +++ b/Lib/test/test_timeout.py @@ -130,17 +130,19 @@ class TimeoutTestCase(unittest.TestCase): def testRecvTimeout(self): # Test recv() timeout _timeout = 0.02 - self.sock.connect(self.addr_remote) - self.sock.settimeout(_timeout) - _t1 = time.time() - self.assertRaises(socket.error, self.sock.recv, 1024) - _t2 = time.time() + with support.transient_internet(self.addr_remote[0]): + self.sock.connect(self.addr_remote) + self.sock.settimeout(_timeout) - _delta = abs(_t1 - _t2) - self.assertTrue(_delta < _timeout + self.fuzz, - "timeout (%g) is %g seconds more than expected (%g)" - %(_delta, self.fuzz, _timeout)) + _t1 = time.time() + self.assertRaises(socket.timeout, self.sock.recv, 1024) + _t2 = time.time() + + _delta = abs(_t1 - _t2) + self.assertTrue(_delta < _timeout + self.fuzz, + "timeout (%g) is %g seconds more than expected (%g)" + %(_delta, self.fuzz, _timeout)) def testAcceptTimeout(self): # Test accept() timeout |