Testing asynchronous applications with FastAPI and pytest
summary
Shows concrete test code: unit tests use FastAPI test client with async mocks to avoid startup pubsub calls, end‑to‑end tests use pytest + httpx async client against a running server and a real redis pub/sub, creating a subscriber task, posting a user, asserting the broadcasted create event, then unsubscribing. Demonstrates kernelCI‑API backend, specific fixtures, async mock usage, ordered tests and that the pipeline passes when redis and the API are actually run.
AI-written summary · about
chapters (4)
related talks
45mEfficient FastAPI testing with pytest, dependency injection and snapshots
49mFor those about to Mock I salute you!
24mTesting Your Python Code
24mAn Introduction to FastAPI
37mRethinking How We Test Our Async Architecture
31mAdventures in FastAPI: A Choose-Your-Own PyCon AU Talk
51mThe Swag of Performance Testing
38mHow to Stop Hating Tests with Jest, Supertest and Cypress
