Skip to main content

Coverage

DAGZ uses a home-grown, optimized coverage collector that instruments Python bytecode directly — no sys.settrace, no source modifications, no decorators. The overhead is near-zero compared to standard coverage tools.

What Gets Tracked

  • Functions and methods — direct calls, indirect calls through the call chain
  • Module-level code — global variables, class definitions, import side effects
  • Fixtures — pytest fixtures are tracked the same way as test functions
  • Dynamic imports — imports inside functions are captured at runtime
  • Registries — plugin registries, signal handlers, and similar patterns with per-entry precision
  • Caches — memoized functions called from multiple tests affect both, even when the second test didn't trigger full execution.

Distributed Coverage

Tests that spawn child processes (via subprocess, multiprocessing, etc.) normally lose coverage in the child. DAGZ automatically injects tracking into child processes and merges their coverage back into the parent test.

This is essential for end-to-end tests that launch servers, CLI tools, or worker pools.

Content Hashing

DAGZ identifies code by its content hash, not its name or line number:

  • Reformatting code → no tests selected (DAGZ normalizes whitespace)
  • Adding a comment → no tests selected (comments are stripped before hashing)
  • Changing actual logic → affected tests are selected

Terminal Capture

DAGZ captures stdout/stderr using a pseudo-terminal, so you don't lose stdout/stderr sync, nor fancy colors (usually lost with pytest pipe capturing).