summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_socket.py
diff options
context:
space:
mode:
authorZackery Spytz <zspytz@gmail.com>2019-06-30 15:24:43 (GMT)
committerAndrew Svetlov <andrew.svetlov@gmail.com>2019-06-30 15:24:43 (GMT)
commitc2cda638d63b98f5cf9a8ef13e15aace2b7e3f0b (patch)
treeed96b086ade6f8a2b2c3b589918636d450f64ad3 /Lib/test/test_socket.py
parent0d671c04c39b52e44597491b893eb0b6c86b3d45 (diff)
downloadcpython-c2cda638d63b98f5cf9a8ef13e15aace2b7e3f0b.zip
cpython-c2cda638d63b98f5cf9a8ef13e15aace2b7e3f0b.tar.gz
cpython-c2cda638d63b98f5cf9a8ef13e15aace2b7e3f0b.tar.bz2
bpo-37199: Fix test failures when IPv6 is unavailable or disabled (#14480)
Diffstat (limited to 'Lib/test/test_socket.py')
-rw-r--r--Lib/test/test_socket.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/Lib/test/test_socket.py b/Lib/test/test_socket.py
index 50094de..e92f871 100644
--- a/Lib/test/test_socket.py
+++ b/Lib/test/test_socket.py
@@ -4964,8 +4964,15 @@ class NetworkConnectionNoServer(unittest.TestCase):
# Issue #9792: create_connection() should not recast timeout errors
# as generic socket errors.
with self.mocked_socket_module():
- with self.assertRaises(socket.timeout):
+ try:
socket.create_connection((HOST, 1234))
+ except socket.timeout:
+ pass
+ except OSError as exc:
+ if support.IPV6_ENABLED or exc.errno != errno.EAFNOSUPPORT:
+ raise
+ else:
+ self.fail('socket.timeout not raised')
class NetworkConnectionAttributesTest(SocketTCPTest, ThreadableTest):