Skip to content

Testing

Utsha Basak edited this page Oct 24, 2026 · 1 revision

Testing

Principles

  • Every behaviour change comes with tests.
  • No network access in tests; external APIs are mocked.
  • Deterministic: fixed random seeds, fixed clocks where time matters.
  • Cross-platform: CI runs on Linux and Windows, and tests must handle CRLF line endings.

Layout

Directory Contents
tests/unit/ Fast, isolated tests per module
tests/integration/ End-to-end flows (simulator to report)
tests/fixtures/ Small synthetic inputs
tests/golden/ Expected outputs for golden-file tests (reports, CLI output)

Kinds of tests

Kind Used for
Unit Parsers, schema validation, rule matching, scoring, redaction
Property-based (Hypothesis) Parsers never crash; the window engine is order-independent within its lateness bound
Golden-file Report layouts and CLI output stay stable
Rule tests Every detection rule has positive and negative fixtures; the suite fails if one is missing
Integration Simulator, parse, detect, incidents, report, with ground-truth assertions
ML Tiny fixture datasets, leakage assertions, seed reproducibility

Markers

uv run pytest -m "not slow"        # skip long-running tests
uv run pytest -m integration       # only integration tests

Warnings are treated as errors, and coverage below 85 % fails the run.

Clone this wiki locally