Commit e9e95938 authored by R. David Murray's avatar R. David Murray

Merged revisions 78014 via svnmerge from

svn+ssh://pythondev@svn.python.org/python/trunk

........
  r78014 | r.david.murray | 2010-02-05 23:27:21 -0500 (Fri, 05 Feb 2010) | 5 lines

  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.
........
parent 41647d6d
...@@ -101,7 +101,7 @@ class TimeoutTestCase(unittest.TestCase): ...@@ -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 @@ class TimeoutTestCase(unittest.TestCase): ...@@ -146,7 +146,8 @@ class TimeoutTestCase(unittest.TestCase):
# 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
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 @@ class TimeoutTestCase(unittest.TestCase): ...@@ -163,7 +164,8 @@ class TimeoutTestCase(unittest.TestCase):
_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
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)
......
...@@ -716,6 +716,9 @@ Documentation ...@@ -716,6 +716,9 @@ Documentation
Tests 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 - Issue #7376: instead of running a self-test (which was failing) when called
with no arguments, doctest.py now gives a usage message. with no arguments, doctest.py now gives a usage message.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment