For AI agents: the complete documentation index is available at /llms.txt, the full documentation bundle is available at /llms-full.txt, and this page is available as Markdown at /packs/languages/python/testing.md.
Quick start

Testing

Test value contracts and the actual resource boundary, including failure propagation.

Verification

Why

A syntax check can parse a returns import without proving that the library is installed or its types are compatible.

Rules

  • MUST exercise successful and failed Result variants through observable outcomes. [review]
  • MUST test real disposable filesystem and subprocess resources. [review]
  • MUST execute examples in an isolated environment with their declared dependencies. [review]
  • MUST typecheck returns examples with the supported mypy version and returns plugin. [review]
  • MUST configure the consumer's lint and formatting checks and run them with tests. [review]
  • MUST avoid paid or nondeterministic external calls in ordinary suites. [review]
  • MUST use test assertions only for verification, not model them as domain failure handling. [review]
  • MUST report syntax-only verification distinctly from execution and typechecking. [review]
  • MAY use property tests for parsers and immutable transformations after dependency approval. [review]

[review]

The configured runner, typechecker, formatter, and exception-syntax checks enforce their contracts. Review checks meaningful coverage and real boundary use.

Enforcement

The configured runner, typechecker, formatter, and exception-syntax checks enforce their contracts. Review checks meaningful coverage and real boundary use.