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.AsyncClient over ASGITransport(app=app) (use this, not Starlette TestClient)
  • mock_db_session — AsyncMock standing in for AsyncSession
  • mock_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
Installs
2
GitHub Stars
2.0K
First Seen
Sep 25, 2026