Awesome Reviewers

Verification · Static analysis · Documentation build

Doctests

Run code examples in documentation as tests.

How to build it

  1. Enable doctest collection, such as pytest --doctest-modules or cargo test for Rust doc comments.
  2. Write examples as runnable snippets with the expected output.
  3. Run the doctest step in the same CI job as the unit tests.

Signals in a repository

  • A pytest configuration with doctest_modules or doctest_glob set.
  • Code examples in docstrings or doc comments that include expected output.

In practice

106 repositories run a tool for this check in the scanned set.

  • pytest · 77 repos
  • cargo-test · 44 repos

Examples