summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_timeout.py
diff options
context:
space:
mode:
authorR. David Murray <rdmurray@bitdance.com>2010-02-06 05:09:09 (GMT)
committerR. David Murray <rdmurray@bitdance.com>2010-02-06 05:09:09 (GMT)
commitf35c87631de0a5c24665bf0cf2ae53f46b6c0ba3 (patch)
tree75da3d21e6e5d15b100878008539855e9d35e528 /Lib/test/test_timeout.py
parenta1bd445e6cc22718559ade054f9403f43f2ea319 (diff)
downloadcpython-f35c87631de0a5c24665bf0cf2ae53f46b6c0ba3.zip
cpython-f35c87631de0a5c24665bf0cf2ae53f46b6c0ba3.tar.gz
cpython-f35c87631de0a5c24665bf0cf2ae53f46b6c0ba3.tar.bz2
Merged revisions 78016 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k ................ r78016 | r.david.murray | 2010-02-06 00:00:15 -0500 (Sat, 06 Feb 2010) | 11 lines 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. ........ ................
Diffstat (limited to 'Lib/test/test_timeout.py')
-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 e8e2a6f..b67cbc9 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
+ 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
+ support.bind_port(self.sock, self.localhost)
_t1 = time.time()
self.assertRaises(socket.error, self.sock.recvfrom, 8192)