summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authorR. David Murray <rdmurray@bitdance.com>2010-02-06 04:27:21 (GMT)
committerR. David Murray <rdmurray@bitdance.com>2010-02-06 04:27:21 (GMT)
commitce6e4b0930f3beaff0d2d11f7473d295d87866c5 (patch)
tree12ed646fa48b44b66ac4d78774391cd20b2431c3 /Lib/test
parent0877060f8690c50865c3840585c6ce285a99c07c (diff)
downloadcpython-ce6e4b0930f3beaff0d2d11f7473d295d87866c5.zip
cpython-ce6e4b0930f3beaff0d2d11f7473d295d87866c5.tar.gz
cpython-ce6e4b0930f3beaff0d2d11f7473d295d87866c5.tar.bz2
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.
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/test_timeout.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/Lib/test/test_timeout.py b/Lib/test/test_timeout.py
index 04cfbe7..5f19af2 100644
--- a/Lib/test/test_timeout.py
+++ b/Lib/test/test_timeout.py
@@ -101,7 +101,7 @@ class TimeoutTestCase(unittest.TestCase):
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()
@@ -146,7 +146,8 @@ class TimeoutTestCase(unittest.TestCase):
# Test accept() timeout
_timeout = 2
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)
_t1 = time.time()
@@ -163,7 +164,8 @@ class TimeoutTestCase(unittest.TestCase):
_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
+ test_support.bind_port(self.sock, self.localhost)
_t1 = time.time()
self.assertRaises(socket.error, self.sock.recvfrom, 8192)