Backend (pytest)

Configuration: agency-django/pyproject.toml → [tool.pytest.ini_options].

Collection is limited to tests/test_*.py — Django management commands named *_test.py are never picked up.

Settings

Context

DJANGO_SETTINGS_MODULE

Local / CI pytest

tests.settings (SQLite, in-memory Channels)

./dev test in Docker

server.settings (Postgres, Redis, …)

CI checks out agency-django only (private repos — no agency-server submodule).

Layout

Path

Role

tests/settings.py tests/urls.py tests/conftest.py tests/factories.py tests/support/mocks.py

Standalone Django settings Routes agency.urls for API/WS tests Celery eager, LLM mocks, fixtures Domain builders LangGraph / chat doubles

Markers

  • @pytest.mark.unit — default fast tests

  • @pytest.mark.integration — multi-component flows, mocked LLM

  • @pytest.mark.docker — real stack smoke (deselected unless -m docker)

Default addopts excludes docker (-m "not docker").

Commands

Command

Description

cd agency-django && pytest

Local SQLite suite (no Docker)

./dev test

pytest inside agency_django container

./dev test -m integration -v

Runtime / HITL / Celery (mocked LLM)

./dev test-docker

AGENCY_DOCKER_TESTS=1 — hits localhost nginx/Redis/Postgres

Coverage

pytest --cov=agency with fail_under = 35 in pyproject.toml.

GitHub Actions (~36% on ubuntu-latest; ~44% in Docker dev stack). Target 40%.

Workflow: agency-django/.github/workflows/tests.yml — see Continuous integration.