mirror of
https://github.com/python/cpython.git
synced 2025-09-26 18:29:57 +00:00
Issue #7547: fix transient failures due to network glitches in test_timeout.
Patch by Sandro Tosi.
This commit is contained in:
parent
3cdfb12360
commit
83432babfd
1 changed files with 11 additions and 9 deletions
|
@ -130,11 +130,13 @@ class TimeoutTestCase(unittest.TestCase):
|
||||||
def testRecvTimeout(self):
|
def testRecvTimeout(self):
|
||||||
# Test recv() timeout
|
# Test recv() timeout
|
||||||
_timeout = 0.02
|
_timeout = 0.02
|
||||||
|
|
||||||
|
with support.transient_internet(self.addr_remote[0]):
|
||||||
self.sock.connect(self.addr_remote)
|
self.sock.connect(self.addr_remote)
|
||||||
self.sock.settimeout(_timeout)
|
self.sock.settimeout(_timeout)
|
||||||
|
|
||||||
_t1 = time.time()
|
_t1 = time.time()
|
||||||
self.assertRaises(socket.error, self.sock.recv, 1024)
|
self.assertRaises(socket.timeout, self.sock.recv, 1024)
|
||||||
_t2 = time.time()
|
_t2 = time.time()
|
||||||
|
|
||||||
_delta = abs(_t1 - _t2)
|
_delta = abs(_t1 - _t2)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue