pytest-asyncio with asyncio_mode=auto runs every test in an event loop. A self-healing fixture creates the test database if missing, runs alembic upgrade, and uses NullPool so each test gets a fresh engine. One fixture, zero shared state, no ordering bugs.
conftest.py: create test DB if missing, alembic upgrade, NullPool engine per test.
asyncio_mode=auto runs pytest-anyio tests transparently.
Override app.config.settings via env so prod credentials never leak into tests.
pytest -> asyncio_mode=auto -> conftest fixture
create test DB -> alembic upgrade -> NullPool engine -> test
Async tests with a self-healing fixture feel boring. That’s the goal.