mirror of https://github.com/encode/starlette.git
Version 0.9
This commit is contained in:
parent
2d631446e9
commit
74d42fa416
|
@ -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
|
You might want to explicitly call into your event handlers in any test setup
|
||||||
or test teardown code.
|
or test teardown code.
|
||||||
|
|
||||||
Alternatively, Starlette provides a context manager that ensures the
|
Alternatively, you can use `TestClient` as a context manager, to ensure that
|
||||||
lifespan events are called.
|
startup and shutdown events are called.
|
||||||
|
|
||||||
```python
|
```python
|
||||||
from example import app
|
from example import app
|
||||||
|
@ -68,9 +68,8 @@ from starlette.testclient import TestClient
|
||||||
|
|
||||||
|
|
||||||
def test_homepage():
|
def test_homepage():
|
||||||
with LifespanContext(app):
|
with TestClient(app) as client:
|
||||||
# Application 'startup' handlers are called on entering the block.
|
# Application 'startup' handlers are called on entering the block.
|
||||||
client = TestClient(app)
|
|
||||||
response = client.get("/")
|
response = client.get("/")
|
||||||
assert response.status_code == 200
|
assert response.status_code == 200
|
||||||
|
|
||||||
|
|
|
@ -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
|
## 0.8.8
|
||||||
|
|
||||||
* Better support for third-party API schema generators.
|
* Better support for third-party API schema generators.
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
__version__ = "0.8.8"
|
__version__ = "0.9.0"
|
||||||
|
|
Loading…
Reference in New Issue