Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e9e9593

Browse files
committed
Merged revisions 78014 via svnmerge from
svn+ssh://[email protected]/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. ........
1 parent 41647d6 commit e9e9593

2 files changed

Lines changed: 8 additions & 3 deletions

File tree

Lib/test/test_timeout.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ class TimeoutTestCase(unittest.TestCase):
101101
def setUp(self):
102102
self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
103103
self.addr_remote = ('www.python.org.', 80)
104-
self.addr_local = ('127.0.0.1', 25339)
104+
self.localhost = '127.0.0.1'
105105

106106
def tearDown(self):
107107
self.sock.close()
@@ -146,7 +146,8 @@ def testAcceptTimeout(self):
146146
# Test accept() timeout
147147
_timeout = 2
148148
self.sock.settimeout(_timeout)
149-
self.sock.bind(self.addr_local)
149+
# Prevent "Address already in use" socket exceptions
150+
support.bind_port(self.sock, self.localhost)
150151
self.sock.listen(5)
151152

152153
_t1 = time.time()
@@ -163,7 +164,8 @@ def testRecvfromTimeout(self):
163164
_timeout = 2
164165
self.sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
165166
self.sock.settimeout(_timeout)
166-
self.sock.bind(self.addr_local)
167+
# Prevent "Address already in use" socket exceptions
168+
support.bind_port(self.sock, self.localhost)
167169

168170
_t1 = time.time()
169171
self.assertRaises(socket.error, self.sock.recvfrom, 8192)

Misc/NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -716,6 +716,9 @@ Documentation
716716
Tests
717717
-----
718718

719+
- issue #7728: test_timeout was changed to use test_support.bind_port
720+
instead of a hard coded port.
721+
719722
- Issue #7376: instead of running a self-test (which was failing) when called
720723
with no arguments, doctest.py now gives a usage message.
721724

0 commit comments

Comments
 (0)