mirror of
https://github.com/python/cpython.git
synced 2025-08-16 14:50:43 +00:00
bpo-37199: Fix test failures when IPv6 is unavailable or disabled (GH-14480)
(cherry picked from commit c2cda638d6
)
Co-authored-by: Zackery Spytz <zspytz@gmail.com>
This commit is contained in:
parent
bf8cb31803
commit
c2684c6d62
5 changed files with 21 additions and 4 deletions
|
@ -4814,8 +4814,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):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue