@@ -924,59 +924,6 @@ def test_wait_closed_on_close_with_unread_data(self):
924924 wr .close ()
925925 self .loop .run_until_complete (wr .wait_closed ())
926926
927- def test_del_stream_before_sock_closing (self ):
928- messages = []
929- self .loop .set_exception_handler (lambda loop , ctx : messages .append (ctx ))
930-
931- with test_utils .run_test_server () as httpd :
932- with self .assertWarns (DeprecationWarning ):
933- rd , wr = self .loop .run_until_complete (
934- asyncio .open_connection (* httpd .address , loop = self .loop ))
935- sock = wr .get_extra_info ('socket' )
936- self .assertNotEqual (sock .fileno (), - 1 )
937-
938- wr .write (b'GET / HTTP/1.0\r \n \r \n ' )
939- f = rd .readline ()
940- data = self .loop .run_until_complete (f )
941- self .assertEqual (data , b'HTTP/1.0 200 OK\r \n ' )
942-
943- # drop refs to reader/writer
944- del rd
945- del wr
946- gc .collect ()
947- # make a chance to close the socket
948- test_utils .run_briefly (self .loop )
949-
950- self .assertEqual (1 , len (messages ))
951- self .assertEqual (sock .fileno (), - 1 )
952-
953- self .assertEqual (1 , len (messages ))
954- self .assertEqual ('An open stream object is being garbage '
955- 'collected; call "stream.close()" explicitly.' ,
956- messages [0 ]['message' ])
957-
958- def test_del_stream_before_connection_made (self ):
959- messages = []
960- self .loop .set_exception_handler (lambda loop , ctx : messages .append (ctx ))
961-
962- with test_utils .run_test_server () as httpd :
963- rd = asyncio .StreamReader (loop = self .loop )
964- pr = asyncio .StreamReaderProtocol (rd , loop = self .loop )
965- del rd
966- gc .collect ()
967- tr , _ = self .loop .run_until_complete (
968- self .loop .create_connection (
969- lambda : pr , * httpd .address ))
970-
971- sock = tr .get_extra_info ('socket' )
972- self .assertEqual (sock .fileno (), - 1 )
973-
974- self .assertEqual (1 , len (messages ))
975- self .assertEqual ('An open stream was garbage collected prior to '
976- 'establishing network connection; '
977- 'call "stream.close()" explicitly.' ,
978- messages [0 ]['message' ])
979-
980927 def test_async_writer_api (self ):
981928 async def inner (httpd ):
982929 rd , wr = await asyncio .open_connection (* httpd .address )
0 commit comments