diff --git a/docs/events.md b/docs/events.md index 3378a83e..d04d31ee 100644 --- a/docs/events.md +++ b/docs/events.md @@ -58,8 +58,8 @@ latest `uvicorn` release if you need startup/cleanup support. You might want to explicitly call into your event handlers in any test setup or test teardown code. -Alternatively, Starlette provides a context manager that ensures the -lifespan events are called. +Alternatively, you can use `TestClient` as a context manager, to ensure that +startup and shutdown events are called. ```python from example import app @@ -68,9 +68,8 @@ from starlette.testclient import TestClient def test_homepage(): - with LifespanContext(app): + with TestClient(app) as client: # Application 'startup' handlers are called on entering the block. - client = TestClient(app) response = client.get("/") assert response.status_code == 200 diff --git a/docs/release-notes.md b/docs/release-notes.md index f4f6e844..5c80c5f8 100644 --- a/docs/release-notes.md +++ b/docs/release-notes.md @@ -1,3 +1,9 @@ +## 0.9.0 + +* `TestClient` can now be used as a context manager, instead of `LifespanContext`. +* Lifespan is now handled as middleware. Startup and Shutdown events are +visible throughout the middleware stack. + ## 0.8.8 * Better support for third-party API schema generators. diff --git a/starlette/__init__.py b/starlette/__init__.py index aa00ec3d..3e2f46a3 100644 --- a/starlette/__init__.py +++ b/starlette/__init__.py @@ -1 +1 @@ -__version__ = "0.8.8" +__version__ = "0.9.0"