Skip to content

🧪 Testing

What's covered and how to run the gates.


📁 Layout

Path Content
tests/unit/ Pure unit tests (domain, extraction stages, enrichment helpers)
tests/domain/ Domain sub-suites: resources, enrichment, fetch pipeline
tests/ (integration) Mongo-backed repo/service integration tests

🚀 Running

# Full unit suite
.\.venv\Scripts\pytest.exe tests\unit -q

# A single area
.\.venv\Scripts\pytest.exe tests\domain\enrichment -q

# Lint gate (baseline ~79 pre-existing errors on main; don't add new ones)
.\.venv\Scripts\ruff.exe check domain infra interfaces pipelines

# Syntax gate on everything including new stubs
.\.venv\Scripts\python.exe -m py_compile .\main.py .\worker.py
Get-ChildItem -Recurse -Filter *.py -Path domain,infra,interfaces,pipelines | `
  ForEach-Object { .\.venv\Scripts\python.exe -m py_compile $_.FullName }

Current health: 1190 passed, 1 skipped; all *.pyi lint-clean after the F821 fixes in the enrichment pipeline stubs.


🧩 What's Heavily Tested

  • Enrichment — identity/fingerprint edge cases, tag flag computation, pipeline wiring.
  • Extraction — CSV/XLSX/PDF tabular parsing against golden fixtures, ambiguity detection.
  • Repos — cache invalidation and x-fk population against an in-memory Mongo.

⚠️ Stub Checks

Stubs mirror public signatures exactly. When a signature changes, the .pyi must change with it or the type gate breaks. Two stubs import dagpipe.Pipeline instead of a rogue string forward-ref:

1
2
3
4
# domain/enrichment/entity/pipeline.pyi
# domain/enrichment/tags/pipeline.pyi
from dagpipe import Pipeline
def load() -> Pipeline: ...

Environment · GSDFC Docstrings · Building Docs