mirror of https://github.com/python/cpython.git
issue #7728: test_timeout was using a hardcoded port, which was
causing buildbot failures. Changed to use test_support.bind_port. Patch by Florent Xicluna.
This commit is contained in:
parent
0877060f86
commit
ce6e4b0930
|
@ -101,7 +101,7 @@ class TimeoutTestCase(unittest.TestCase):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||||
self.addr_remote = ('www.python.org.', 80)
|
self.addr_remote = ('www.python.org.', 80)
|
||||||
self.addr_local = ('127.0.0.1', 25339)
|
self.localhost = '127.0.0.1'
|
||||||
|
|
||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
self.sock.close()
|
self.sock.close()
|
||||||
|
@ -146,7 +146,8 @@ def testAcceptTimeout(self):
|
||||||
# Test accept() timeout
|
# Test accept() timeout
|
||||||
_timeout = 2
|
_timeout = 2
|
||||||
self.sock.settimeout(_timeout)
|
self.sock.settimeout(_timeout)
|
||||||
self.sock.bind(self.addr_local)
|
# Prevent "Address already in use" socket exceptions
|
||||||
|
test_support.bind_port(self.sock, self.localhost)
|
||||||
self.sock.listen(5)
|
self.sock.listen(5)
|
||||||
|
|
||||||
_t1 = time.time()
|
_t1 = time.time()
|
||||||
|
@ -163,7 +164,8 @@ def testRecvfromTimeout(self):
|
||||||
_timeout = 2
|
_timeout = 2
|
||||||
self.sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
|
self.sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
|
||||||
self.sock.settimeout(_timeout)
|
self.sock.settimeout(_timeout)
|
||||||
self.sock.bind(self.addr_local)
|
# Prevent "Address already in use" socket exceptions
|
||||||
|
test_support.bind_port(self.sock, self.localhost)
|
||||||
|
|
||||||
_t1 = time.time()
|
_t1 = time.time()
|
||||||
self.assertRaises(socket.error, self.sock.recvfrom, 8192)
|
self.assertRaises(socket.error, self.sock.recvfrom, 8192)
|
||||||
|
|
|
@ -150,6 +150,14 @@ Tools/Demos
|
||||||
added to the `Tools/` directory. They were previously living in the
|
added to the `Tools/` directory. They were previously living in the
|
||||||
sandbox.
|
sandbox.
|
||||||
|
|
||||||
|
|
||||||
|
Tests
|
||||||
|
-----
|
||||||
|
|
||||||
|
- issue #7728: test_timeout was changed to use test_support.bind_port
|
||||||
|
instead of a hard coded port.
|
||||||
|
|
||||||
|
|
||||||
Documentation
|
Documentation
|
||||||
-------------
|
-------------
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue