bpo-42413: socket.timeout is now an alias of TimeoutError (GH-23413)
Signed-off-by: Christian Heimes <christian@python.org>
diff --git a/Lib/test/test_timeout.py b/Lib/test/test_timeout.py
index ac803f5..823d5c3 100644
--- a/Lib/test/test_timeout.py
+++ b/Lib/test/test_timeout.py
@@ -122,7 +122,7 @@ def _sock_operation(self, count, timeout, method, *args):
"""
Test the specified socket method.
- The method is run at most `count` times and must raise a socket.timeout
+ The method is run at most `count` times and must raise a TimeoutError
within `timeout` + self.fuzz seconds.
"""
self.sock.settimeout(timeout)
@@ -131,11 +131,11 @@ def _sock_operation(self, count, timeout, method, *args):
t1 = time.monotonic()
try:
method(*args)
- except socket.timeout as e:
+ except TimeoutError as e:
delta = time.monotonic() - t1
break
else:
- self.fail('socket.timeout was not raised')
+ self.fail('TimeoutError was not raised')
# These checks should account for timing unprecision
self.assertLess(delta, timeout + self.fuzz)
self.assertGreater(delta, timeout - 1.0)
@@ -204,7 +204,7 @@ def testConnectTimeout(self):
sock.settimeout(timeout)
try:
sock.connect((whitehole))
- except socket.timeout:
+ except TimeoutError:
pass
except OSError as err:
if err.errno == errno.ECONNREFUSED: