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

Function test_keepalive

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

Source from the content-addressed store, hash-verified

388
389
390async def test_keepalive(http_protocol_cls: type[HTTPProtocol]):
391 app = Response(b"", status_code=204)
392
393 protocol = get_connected_protocol(app, http_protocol_cls)
394 protocol.data_received(SIMPLE_GET_REQUEST)
395 await protocol.loop.run_one()
396
397 assert b"HTTP/1.1 204 No Content" in protocol.transport.buffer
398 assert not protocol.transport.is_closing()
399
400
401async def test_keepalive_timeout(http_protocol_cls: type[HTTPProtocol]):

Callers

nothing calls this directly

Calls 5

ResponseClass · 0.90
get_connected_protocolFunction · 0.70
data_receivedMethod · 0.45
run_oneMethod · 0.45
is_closingMethod · 0.45

Tested by

no test coverage detected