Testing standard¶
The SDK follows a category-coverage testing standard (per
docs/013_TESTING_STANDARD.md). Every category MUST have 100%
coverage; there is no percentage threshold.
The 9 test categories¶
- Public API unit tests — every public method, every public dataclass. (~ 2,500 tests)
- Internal layer unit tests — every internal module. (~ 200 tests)
- Cookbook verification — every recipe runs in mock mode. (~ 100 tests)
- CLI integration tests — every CLI command, every output format. (~ 250 tests)
- Storage round-trip tests — every backend, every shape. (~ 100 tests)
- Analytics equivalence tests — every public analytics function. (~ 400 tests)
- Regression guards — every known fix has a guard. (~ 60 tests)
- Audit tool tests — every audit script has a self-test. (~ 30 tests)
- Live API integration tests — opt-in, runs against the real UN Comtrade API. (separate suite; not part of CI)
The 3 quality gates¶
- Build gate —
pip install -e .succeeds. - Test gate —
pytest tests/ -xpasses with all tests green (3,117+ as of v1.0.1). - Lint gate —
ruff check un_comtrade/andmypy un_comtrade/pass with no errors.
The 5-defect-category taxonomy¶
| Severity | Definition | Action |
|---|---|---|
| Critical | Crashes on a documented use path. | Block release. |
| High | Wrong output on a documented use path. | Block release. |
| Medium | Wrong output on an undocumented edge case. | Fix in patch release. |
| Low | Cosmetic or minor documentation drift. | Fix in next minor. |
| Informational | Code smell or improvement opportunity. | Track in DECISIONS. |
The 7 continuous verification mechanisms¶
pytest tests/ -x— full unit suite on every commit.pytest tests/test_recipes_verification.py— recipe contract.python scripts/build_docs.py— documentation build + 8-step verification harness.tools/audit_layer_boundaries.py— AST-based layer-boundary check.tools/audit_public_api.py— public API surface vs.__all__reconciliation.tools/audit_circular_deps.py— Tarjan SCC analysis (0 cycles required).tools/audit_package_hygiene.py— module size, docstring presence, import hygiene.
Running the suite¶
# Full suite
pytest tests/ -x
# Only the cookbook verification
pytest tests/test_recipes_verification.py -v
# With coverage
pytest tests/ --cov=un_comtrade --cov-report=term-missing
# Only regression guards
pytest tests/ -k "regression or guard or sync" -v
# Audit tools
python tools/audit_layer_boundaries.py
python tools/audit_public_api.py
python tools/audit_circular_deps.py
python tools/audit_package_hygiene.py
Defect reporting¶
Open an issue at https://github.com/Horizon-Labs-Building-AI-Systems/un-comtrade-sdk/issues. Tag the issue with the appropriate severity and category labels.
Related Recipes¶
None — this is a testing standard, not a recipe.
Related Guides¶
- Cookbook contract — recipe verification.
- Contributing — PR checklist.
Next steps¶
- Cookbook contract — if you're writing recipes.
- Contributing — the PR checklist.