Testing Guide
This page describes how testing works for AMMM V2 and how to run tests reliably.
Test Stack
Section titled “Test Stack”pytestis the primary test runner.pytest-mockis required for many tests.noxruns a Python 3.10–3.12 test matrix (nox -s tests).
Canonical Local Command
Section titled “Canonical Local Command”Use this command for local runs to avoid plugin autoload conflicts:
PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 pytest -q -p pytest_mockRunning Targeted Tests
Section titled “Running Targeted Tests”Run specific tests for faster iteration:
PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 pytest -q -p pytest_mock tests/driver/test_workflow.pyPYTEST_DISABLE_PLUGIN_AUTOLOAD=1 pytest -q -p pytest_mock -k convergenceTest Categories
Section titled “Test Categories”Unit tests
Section titled “Unit tests”Validate isolated functions/classes in src/ modules (for example diagnostics, preprocessing, optimisation helpers).
Integration tests
Section titled “Integration tests”Validate interactions across the V2 workflow (MMMBaseDriverV2, workflow execution, stage artefact generation).
Documentation-aware checks
Section titled “Documentation-aware checks”When workflow/output behaviour changes, verify:
- stage folders remain correct (
00_...to80_...) - machine-readable diagnostics fields are still present:
50_diagnostics/convergence_report.json->converged50_diagnostics/calibration_report.json->well_calibrated50_diagnostics/pareto_k_summary.json->ok
Nox Matrix
Section titled “Nox Matrix”Run the multi-version suite:
nox -s testsThe configured session installs editable package dependencies and executes:
pytest -q -p pytest_mockwith plugin autoload disabled.
Recommended Workflow for Changes
Section titled “Recommended Workflow for Changes”- Run targeted tests for touched modules.
- Run at least one integration path if workflow/output contracts changed.
- Run the canonical local command before opening PR.
- Use
pytest --collect-onlyif you need to validate discovery quickly.
- Generated run artefacts (
results/...) are not test fixtures and should not be committed. - Diagnostics passing supports computational/predictive adequacy checks, not causal proof.