pytest-suite
Installation
SKILL.md
Backend Tests (pytest + anyio)
Tests live in backend/tests/, mirror the source layout (app/services/user.py → tests/services/test_user.py), and run with no real database — conftest.py overrides get_db_session with an AsyncMock via FastAPI dependency_overrides.
Key fixtures (tests/conftest.py)
client—httpx.AsyncClientoverASGITransport(app=app)(use this, not StarletteTestClient)mock_db_session—AsyncMockstanding in forAsyncSessionmock_redis(when Redis is enabled),api_key_headers(when API keys are enabled)
Patterns
Async tests use anyio, not @pytest.mark.asyncio:
import pytest
pytestmark = pytest.mark.anyio # at module top, or mark per-test