@@ -627,56 +627,6 @@ async def certificate_error(*args, **kwargs):
627627 await conn .close ()
628628
629629
630- async def test_tcp_connector_closes_socket_on_error (
631- loop : asyncio .AbstractEventLoop , start_connection : mock .AsyncMock
632- ) -> None :
633- req = ClientRequest ("GET" , URL ("https://127.0.0.1:443" ), loop = loop )
634-
635- conn = aiohttp .TCPConnector ()
636- with (
637- mock .patch .object (
638- conn ._loop ,
639- "create_connection" ,
640- autospec = True ,
641- spec_set = True ,
642- side_effect = ValueError ,
643- ),
644- pytest .raises (ValueError ),
645- ):
646- await conn .connect (req , [], ClientTimeout ())
647-
648- assert start_connection .return_value .close .called
649-
650- await conn .close ()
651-
652-
653- async def test_tcp_connector_closes_socket_on_error_results_in_another_error (
654- loop : asyncio .AbstractEventLoop , start_connection : mock .AsyncMock
655- ) -> None :
656- """Test that when error occurs while closing the socket."""
657- req = ClientRequest ("GET" , URL ("https://127.0.0.1:443" ), loop = loop )
658- start_connection .return_value .close .side_effect = OSError (
659- 1 , "error from closing socket"
660- )
661-
662- conn = aiohttp .TCPConnector ()
663- with (
664- mock .patch .object (
665- conn ._loop ,
666- "create_connection" ,
667- autospec = True ,
668- spec_set = True ,
669- side_effect = ValueError ,
670- ),
671- pytest .raises (aiohttp .ClientConnectionError , match = "error from closing socket" ),
672- ):
673- await conn .connect (req , [], ClientTimeout ())
674-
675- assert start_connection .return_value .close .called
676-
677- await conn .close ()
678-
679-
680630async def test_tcp_connector_server_hostname_default (
681631 loop : Any , start_connection : mock .AsyncMock
682632) -> None :
0 commit comments