@@ -646,56 +646,6 @@ async def test_tcp_connector_certificate_error(
646646 await conn .close ()
647647
648648
649- async def test_tcp_connector_closes_socket_on_error (
650- loop : asyncio .AbstractEventLoop , start_connection : mock .AsyncMock
651- ) -> None :
652- req = ClientRequest ("GET" , URL ("https://127.0.0.1:443" ), loop = loop )
653-
654- conn = aiohttp .TCPConnector ()
655- with (
656- mock .patch .object (
657- conn ._loop ,
658- "create_connection" ,
659- autospec = True ,
660- spec_set = True ,
661- side_effect = ValueError ,
662- ),
663- pytest .raises (ValueError ),
664- ):
665- await conn .connect (req , [], ClientTimeout ())
666-
667- assert start_connection .return_value .close .called
668-
669- await conn .close ()
670-
671-
672- async def test_tcp_connector_closes_socket_on_error_results_in_another_error (
673- loop : asyncio .AbstractEventLoop , start_connection : mock .AsyncMock
674- ) -> None :
675- """Test that when error occurs while closing the socket."""
676- req = ClientRequest ("GET" , URL ("https://127.0.0.1:443" ), loop = loop )
677- start_connection .return_value .close .side_effect = OSError (
678- 1 , "error from closing socket"
679- )
680-
681- conn = aiohttp .TCPConnector ()
682- with (
683- mock .patch .object (
684- conn ._loop ,
685- "create_connection" ,
686- autospec = True ,
687- spec_set = True ,
688- side_effect = ValueError ,
689- ),
690- pytest .raises (aiohttp .ClientConnectionError , match = "error from closing socket" ),
691- ):
692- await conn .connect (req , [], ClientTimeout ())
693-
694- assert start_connection .return_value .close .called
695-
696- await conn .close ()
697-
698-
699649async def test_tcp_connector_server_hostname_default (
700650 loop : asyncio .AbstractEventLoop , start_connection : mock .AsyncMock
701651) -> None :
0 commit comments