diff options
| author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2019-06-30 08:42:22 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-06-30 08:42:22 -0700 |
| commit | c2684c6d62978e9ce8256c3c7744d0332a2abe4c (patch) | |
| tree | 4e7484fbb1aaabfcf3fe7d089d80e3c00c9e7903 /Lib/test/test_socket.py | |
| parent | bf8cb31803558f1105efb15b0ee4bd184f3218c8 (diff) | |
| download | cpython-git-c2684c6d62978e9ce8256c3c7744d0332a2abe4c.tar.gz | |
bpo-37199: Fix test failures when IPv6 is unavailable or disabled (GH-14480)
(cherry picked from commit c2cda638d63b98f5cf9a8ef13e15aace2b7e3f0b)
Co-authored-by: Zackery Spytz <zspytz@gmail.com>
Diffstat (limited to 'Lib/test/test_socket.py')
| -rw-r--r-- | Lib/test/test_socket.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/Lib/test/test_socket.py b/Lib/test/test_socket.py index 74662cfeb3..db525642d6 100644 --- a/Lib/test/test_socket.py +++ b/Lib/test/test_socket.py @@ -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): |
