summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_asyncio
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2019-06-30 15:42:22 (GMT)
committerGitHub <noreply@github.com>2019-06-30 15:42:22 (GMT)
commitc2684c6d62978e9ce8256c3c7744d0332a2abe4c (patch)
tree4e7484fbb1aaabfcf3fe7d089d80e3c00c9e7903 /Lib/test/test_asyncio
parentbf8cb31803558f1105efb15b0ee4bd184f3218c8 (diff)
downloadcpython-c2684c6d62978e9ce8256c3c7744d0332a2abe4c.zip
cpython-c2684c6d62978e9ce8256c3c7744d0332a2abe4c.tar.gz
cpython-c2684c6d62978e9ce8256c3c7744d0332a2abe4c.tar.bz2
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_asyncio')
-rw-r--r--Lib/test/test_asyncio/test_base_events.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/Lib/test/test_asyncio/test_base_events.py b/Lib/test/test_asyncio/test_base_events.py
index 811b374..08d4792 100644
--- a/Lib/test/test_asyncio/test_base_events.py
+++ b/Lib/test/test_asyncio/test_base_events.py
@@ -91,6 +91,9 @@ class BaseEventTests(test_utils.TestCase):
self.assertIsNone(
base_events._ipaddr_info('1.2.3.4', 1, UNSPEC, 0, 0))
+ if not support.IPV6_ENABLED:
+ return
+
# IPv4 address with family IPv6.
self.assertIsNone(
base_events._ipaddr_info('1.2.3.4', 1, INET6, STREAM, TCP))
@@ -1149,7 +1152,7 @@ class BaseEventLoopWithSelectorTests(test_utils.TestCase):
srv.close()
self.loop.run_until_complete(srv.wait_closed())
- @unittest.skipUnless(hasattr(socket, 'AF_INET6'), 'no IPv6 support')
+ @unittest.skipUnless(support.IPV6_ENABLED, 'no IPv6 support')
def test_create_server_ipv6(self):
async def main():
with self.assertWarns(DeprecationWarning):
@@ -1281,6 +1284,9 @@ class BaseEventLoopWithSelectorTests(test_utils.TestCase):
t.close()
test_utils.run_briefly(self.loop) # allow transport to close
+ if not support.IPV6_ENABLED:
+ return
+
sock.family = socket.AF_INET6
coro = self.loop.create_connection(asyncio.Protocol, '::1', 80)
t, p = self.loop.run_until_complete(coro)
@@ -1298,6 +1304,7 @@ class BaseEventLoopWithSelectorTests(test_utils.TestCase):
t.close()
test_utils.run_briefly(self.loop) # allow transport to close
+ @unittest.skipUnless(support.IPV6_ENABLED, 'no IPv6 support')
@unittest.skipIf(sys.platform.startswith('aix'),
"bpo-25545: IPv6 scope id and getaddrinfo() behave differently on AIX")
@patch_socket