Files
basicmachines-co-basic-memory/docs/testing-coverage.md
T
Paul Hernandez b4486d20bd test: remove stdlib mocks, strengthen integration coverage (#489)
Signed-off-by: phernandez <paul@basicmachines.co>
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-02 14:22:01 -06:00

1.5 KiB
Raw Permalink Blame History

Coverage policy (practical 100%)

Basic Memorys test suite intentionally mixes:

  • unit tests (fast, deterministic)
  • integration tests (real filesystem + real DB via test-int/)

To keep the default CI signal stable and meaningful, the default pytest coverage report targets core library logic and excludes a small set of modules that are either:

  • highly environment-dependent (OS/DB tuning)
  • inherently interactive (CLI)
  • background-task orchestration (watchers/sync runners)
  • external analytics

Whats excluded (and why)

Coverage excludes are configured in pyproject.toml under [tool.coverage.report].omit.

Current exclusions include:

  • src/basic_memory/cli/**: interactive wrappers; behavior is validated via higher-level tests and smoke tests.
  • src/basic_memory/db.py: platform/backend tuning paths (SQLite/Postgres/Windows), covered by integration tests and targeted runs.
  • src/basic_memory/services/initialization.py: startup orchestration/background tasks; covered indirectly by app/MCP entrypoints.
  • src/basic_memory/sync/sync_service.py: heavy filesystem↔DB integration; validated in integration suite (not enforced in unit coverage).
  • src/basic_memory/telemetry.py: external analytics; exercised lightly but excluded from strict coverage gate.

If you want extra confidence locally/CI:

  • Postgres backend: run tests with BASIC_MEMORY_TEST_POSTGRES=1.
  • Strict backend-complete coverage: run coverage on SQLite + Postgres and combine the results (recommended).