Browse Source
`lifespan` should be included in th document, instead of only `startup` and `shutdown`pull/13259/head^2
2 changed files with 20 additions and 6 deletions
@ -1,5 +1,7 @@ |
|||
# Testing Events: startup - shutdown |
|||
|
|||
When you need your event handlers (`startup` and `shutdown`) to run in your tests, you can use the `TestClient` with a `with` statement: |
|||
When you need your event handlers (`lifespan`, `startup` and `shutdown`) to run in your tests, you can use the `TestClient` with a `with` statement: |
|||
|
|||
{* ../../docs_src/app_testing/tutorial003.py hl[9:12,20:24] *} |
|||
You can read more details about the ["Running lifespan in tests in the official Starlette documentation site."](https://www.starlette.io/lifespan/#running-lifespan-in-tests) |
|||
|
|||
{* ../../docs_src/app_testing/tutorial003.py hl[9:15,32:37] *} |
Loading…
Reference in new issue