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

Function test_keepalive_timeout

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

Source from the content-addressed store, hash-verified

399
400
401async def test_keepalive_timeout(http_protocol_cls: type[HTTPProtocol]):
402 app = Response(b"", status_code=204)
403
404 protocol = get_connected_protocol(app, http_protocol_cls)
405 protocol.data_received(SIMPLE_GET_REQUEST)
406 await protocol.loop.run_one()
407 assert b"HTTP/1.1 204 No Content" in protocol.transport.buffer
408 assert not protocol.transport.is_closing()
409 protocol.loop.run_later(with_delay=1)
410 assert not protocol.transport.is_closing()
411 protocol.loop.run_later(with_delay=5)
412 assert protocol.transport.is_closing()
413
414
415async def test_keepalive_timeout_with_pipelined_requests(http_protocol_cls: type[HTTPProtocol]):

Callers

nothing calls this directly

Calls 6

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

Tested by

no test coverage detected