Aller au contenu

Pytest patterns

Status: Placeholder — to be developed. Last reviewed:

Scope

Conventions for tests: directory layout, fixture scope, factory usage, integration vs. unit boundary, when to hit the real DB, naming, what make test / make test-k / make test-f / make test-x actually do.

Sources to mine when writing this

  • conftest.py (root) and any per-app conftest.py files.
  • pytest.ini configuration.
  • Makefile test targets — document what each one is for.
  • Existing test factories (factory_boy or hand-rolled) — converge on one pattern.
  • The recent test_entity_holder fix (commit 76c7d45 — "pin entity name, not just code") — that's a worth-documenting lesson about test brittleness.