@@ -91,6 +91,9 @@ def test_ipaddr_info(self):
9191 self .assertIsNone (
9292 base_events ._ipaddr_info ('1.2.3.4' , 1 , UNSPEC , 0 , 0 ))
9393
94+ if not support .IPV6_ENABLED :
95+ return
96+
9497 # IPv4 address with family IPv6.
9598 self .assertIsNone (
9699 base_events ._ipaddr_info ('1.2.3.4' , 1 , INET6 , STREAM , TCP ))
@@ -1149,7 +1152,7 @@ def test_create_server_stream_bittype(self):
11491152 srv .close ()
11501153 self .loop .run_until_complete (srv .wait_closed ())
11511154
1152- @unittest .skipUnless (hasattr ( socket , 'AF_INET6' ) , 'no IPv6 support' )
1155+ @unittest .skipUnless (support . IPV6_ENABLED , 'no IPv6 support' )
11531156 def test_create_server_ipv6 (self ):
11541157 async def main ():
11551158 with self .assertWarns (DeprecationWarning ):
@@ -1281,6 +1284,9 @@ def _test_create_connection_ip_addr(self, m_socket, allow_inet_pton):
12811284 t .close ()
12821285 test_utils .run_briefly (self .loop ) # allow transport to close
12831286
1287+ if not support .IPV6_ENABLED :
1288+ return
1289+
12841290 sock .family = socket .AF_INET6
12851291 coro = self .loop .create_connection (asyncio .Protocol , '::1' , 80 )
12861292 t , p = self .loop .run_until_complete (coro )
@@ -1298,6 +1304,7 @@ def _test_create_connection_ip_addr(self, m_socket, allow_inet_pton):
12981304 t .close ()
12991305 test_utils .run_briefly (self .loop ) # allow transport to close
13001306
1307+ @unittest .skipUnless (support .IPV6_ENABLED , 'no IPv6 support' )
13011308 @unittest .skipIf (sys .platform .startswith ('aix' ),
13021309 "bpo-25545: IPv6 scope id and getaddrinfo() behave differently on AIX" )
13031310 @patch_socket
0 commit comments