summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_timeout.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/test_timeout.py')
-rw-r--r--Lib/test/test_timeout.py13
1 files changed, 7 insertions, 6 deletions
diff --git a/Lib/test/test_timeout.py b/Lib/test/test_timeout.py
index ff41b13..c0952c7 100644
--- a/Lib/test/test_timeout.py
+++ b/Lib/test/test_timeout.py
@@ -3,6 +3,7 @@
import functools
import unittest
from test import support
+from test.support import socket_helper
# This requires the 'network' resource as given on the regrtest command line.
skip_expected = not support.is_resource_enabled('network')
@@ -110,7 +111,7 @@ class TimeoutTestCase(unittest.TestCase):
# solution.
fuzz = 2.0
- localhost = support.HOST
+ localhost = socket_helper.HOST
def setUp(self):
raise NotImplementedError()
@@ -240,14 +241,14 @@ class TCPTimeoutTestCase(TimeoutTestCase):
def testAcceptTimeout(self):
# Test accept() timeout
- support.bind_port(self.sock, self.localhost)
+ socket_helper.bind_port(self.sock, self.localhost)
self.sock.listen()
self._sock_operation(1, 1.5, 'accept')
def testSend(self):
# Test send() timeout
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as serv:
- support.bind_port(serv, self.localhost)
+ socket_helper.bind_port(serv, self.localhost)
serv.listen()
self.sock.connect(serv.getsockname())
# Send a lot of data in order to bypass buffering in the TCP stack.
@@ -256,7 +257,7 @@ class TCPTimeoutTestCase(TimeoutTestCase):
def testSendto(self):
# Test sendto() timeout
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as serv:
- support.bind_port(serv, self.localhost)
+ socket_helper.bind_port(serv, self.localhost)
serv.listen()
self.sock.connect(serv.getsockname())
# The address argument is ignored since we already connected.
@@ -266,7 +267,7 @@ class TCPTimeoutTestCase(TimeoutTestCase):
def testSendall(self):
# Test sendall() timeout
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as serv:
- support.bind_port(serv, self.localhost)
+ socket_helper.bind_port(serv, self.localhost)
serv.listen()
self.sock.connect(serv.getsockname())
# Send a lot of data in order to bypass buffering in the TCP stack.
@@ -285,7 +286,7 @@ class UDPTimeoutTestCase(TimeoutTestCase):
def testRecvfromTimeout(self):
# Test recvfrom() timeout
# Prevent "Address already in use" socket exceptions
- support.bind_port(self.sock, self.localhost)
+ socket_helper.bind_port(self.sock, self.localhost)
self._sock_operation(1, 1.5, 'recvfrom', 1024)