What problem does it solve?
Writing Litestar tests often leads to flaky, broken suites that fail to initialize app lifespans, mock dependencies correctly, or follow Litestar's async testing conventions, causing missed bugs and wasted debugging time.
Core Features & Use Cases
- Litestar-native test patterns: Covers TestClient vs AsyncTestClient selection, anyio setup, app/lifespan fixtures, and Guard/DI mocking tailored to Litestar's architecture.
- Ecosystem integration: Includes guidance for combining tests with pytest-databases for containerized database testing, and first-party Litestar libraries like litestar-email and litestar-saq.
- Real-world use case: For a Litestar API with auth guards and database dependencies, this skill ensures tests run lifespans correctly, mock side effects via DI overrides, and cover both happy and error paths without flakiness.
Quick Start
Use the litestar-testing skill to write a pytest test suite for your Litestar API that correctly fires app lifespans, mocks external dependencies, and achieves 90% code coverage.