MCPcopy
hub / github.com/encode/starlette / test_raise_on_shutdown

Function test_raise_on_shutdown

tests/test_routing.py:717–727  ·  view source on GitHub ↗
(test_client_factory: TestClientFactory)

Source from the content-addressed store, hash-verified

715
716
717def test_raise_on_shutdown(test_client_factory: TestClientFactory) -> None:
718 @contextlib.asynccontextmanager
719 async def lifespan(app: Starlette) -> AsyncIterator[None]:
720 yield
721 raise RuntimeError("Shutdown failed")
722
723 app = Router(lifespan=lifespan)
724
725 with pytest.raises(RuntimeError, match="Shutdown failed"):
726 with test_client_factory(app):
727 pass # pragma: no cover
728
729
730def test_partial_async_endpoint(test_client_factory: TestClientFactory) -> None:

Callers

nothing calls this directly

Calls 2

RouterClass · 0.90
test_client_factoryFunction · 0.85

Tested by

no test coverage detected