MCPcopy
hub / github.com/encode/uvicorn / test_app_exception

Function test_app_exception

tests/protocols/test_http.py:537–545  ·  view source on GitHub ↗
(http_protocol_cls: type[HTTPProtocol])

Source from the content-addressed store, hash-verified

535
536
537async def test_app_exception(http_protocol_cls: type[HTTPProtocol]):
538 async def app(scope: Scope, receive: ASGIReceiveCallable, send: ASGISendCallable):
539 raise Exception()
540
541 protocol = get_connected_protocol(app, http_protocol_cls)
542 protocol.data_received(SIMPLE_GET_REQUEST)
543 await protocol.loop.run_one()
544 assert b"HTTP/1.1 500 Internal Server Error" in protocol.transport.buffer
545 assert protocol.transport.is_closing()
546
547
548async def test_exception_during_response(http_protocol_cls: type[HTTPProtocol]):

Callers

nothing calls this directly

Calls 4

get_connected_protocolFunction · 0.70
data_receivedMethod · 0.45
run_oneMethod · 0.45
is_closingMethod · 0.45

Tested by

no test coverage detected