def setUp(self):
self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
self.addr_remote = ('www.python.org.', 80)
- self.addr_local = ('127.0.0.1', 25339)
+ self.localhost = '127.0.0.1'
def tearDown(self):
self.sock.close()
# Test accept() timeout
_timeout = 2
self.sock.settimeout(_timeout)
- self.sock.bind(self.addr_local)
+ # Prevent "Address already in use" socket exceptions
+ support.bind_port(self.sock, self.localhost)
self.sock.listen(5)
_t1 = time.time()
_timeout = 2
self.sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
self.sock.settimeout(_timeout)
- self.sock.bind(self.addr_local)
+ # Prevent "Address already in use" socket exceptions
+ support.bind_port(self.sock, self.localhost)
_t1 = time.time()
self.assertRaises(socket.error, self.sock.recvfrom, 8192)
Tests
-----
+- issue #7728: test_timeout was changed to use test_support.bind_port
+ instead of a hard coded port.
+
- Issue #7376: instead of running a self-test (which was failing) when called
with no arguments, doctest.py now gives a usage message.