@@ -595,12 +595,12 @@ def __init__(self, methodName='runTest'):
595595 self .cli = None
596596 self .serv = None
597597
598- def call_socketpair (self ):
598+ def socketpair (self ):
599599 # To be overridden by some child classes.
600600 return socket .socketpair ()
601601
602602 def setUp (self ):
603- self .serv , self .cli = self .call_socketpair ()
603+ self .serv , self .cli = self .socketpair ()
604604
605605 def tearDown (self ):
606606 if self .serv :
@@ -4907,17 +4907,30 @@ def _test_recv(self):
49074907 self .cli .send (MSG )
49084908
49094909 def test_send (self ):
4910- self .serv .send (MSG )
4911-
4912- def _test_send (self ):
49134910 msg = self .cli .recv (1024 )
49144911 self .assertEqual (msg , MSG )
49154912
4916- def _test_injected_authentication_failure (self ):
4917- # No-op. Exists for base class threading infrastructure to call.
4918- # We could refactor this test into its own lesser class along with the
4919- # setUp and tearDown code to construct an ideal; it is simpler to keep
4920- # it here and live with extra overhead one this _one_ failure test.
4913+ def _test_send (self ):
4914+ self .serv .send (MSG )
4915+
4916+ def test_ipv4 (self ):
4917+ cli , srv = socket .socketpair (socket .AF_INET )
4918+ cli .close ()
4919+ srv .close ()
4920+
4921+ def _test_ipv4 (self ):
4922+ pass
4923+
4924+ @unittest .skipIf (not hasattr (_socket , 'IPPROTO_IPV6' ) or
4925+ not hasattr (_socket , 'IPV6_V6ONLY' ),
4926+ "IPV6_V6ONLY option not supported" )
4927+ @unittest .skipUnless (socket_helper .IPV6_ENABLED , 'IPv6 required for this test' )
4928+ def test_ipv6 (self ):
4929+ cli , srv = socket .socketpair (socket .AF_INET6 )
4930+ cli .close ()
4931+ srv .close ()
4932+
4933+ def _test_ipv6 (self ):
49214934 pass
49224935
49234936 def test_injected_authentication_failure (self ):
@@ -4950,8 +4963,16 @@ def inject_getsocketname(self):
49504963 inject_sock .close ()
49514964 if sock1 : # This cleanup isn't needed on a successful test.
49524965 sock1 .close ()
4966+ if sock2 :
49534967 sock2 .close ()
49544968
4969+ def _test_injected_authentication_failure (self ):
4970+ # No-op. Exists for base class threading infrastructure to call.
4971+ # We could refactor this test into its own lesser class along with the
4972+ # setUp and tearDown code to construct an ideal; it is simpler to keep
4973+ # it here and live with extra overhead one this _one_ failure test.
4974+ pass
4975+
49554976
49564977class NonBlockingTCPTests (ThreadedTCPSocketTest ):
49574978
0 commit comments