@@ -451,27 +451,6 @@ async def app(scope: Scope, receive: ASGIReceiveCallable, send: ASGISendCallable
451451 assert websocket .close_code == 1006
452452
453453
454- async def test_close_transport_on_asgi_return (
455- ws_protocol_cls : WSProtocol , http_protocol_cls : HTTPProtocol , unused_tcp_port : int
456- ):
457- """The ASGI callable should call the `websocket.close` event.
458-
459- If it doesn't, the server should still send a close frame to the client.
460- """
461-
462- async def app (scope : Scope , receive : ASGIReceiveCallable , send : ASGISendCallable ):
463- message = await receive ()
464- if message ["type" ] == "websocket.connect" :
465- await send ({"type" : "websocket.accept" })
466-
467- config = Config (app = app , ws = ws_protocol_cls , http = http_protocol_cls , lifespan = "off" , port = unused_tcp_port )
468- async with run_server (config ):
469- async with websockets .client .connect (f"ws://127.0.0.1:{ unused_tcp_port } " ) as websocket :
470- with pytest .raises (websockets .exceptions .ConnectionClosed ):
471- await websocket .recv ()
472- assert websocket .close_code == 1006
473-
474-
475454@pytest .mark .parametrize ("code" , [None , 1000 , 1001 ])
476455@pytest .mark .parametrize ("reason" , [None , "test" , False ], ids = ["none_as_reason" , "normal_reason" , "without_reason" ])
477456async def test_app_close (
0 commit comments