pytest_doctest_docutils

pytest_doctest_docutils lets pytest collect doctests from .rst and .md files. Point pytest at a documentation file or directory, and the plugin parses each page through doctest_docutils before pytest runs the examples.

The plugin blocks pytest’s standard doctest plugin by default so the same examples are not collected twice.

Tutorial

Run documentation doctests through pytest.

Tutorial
How-to

Collect docs, Python modules, and option-flagged examples.

How-to
Fixtures

Share setup through doctest_namespace and autouse fixtures.

Fixtures
API Reference

Inspect collector, runner, and pytest hook APIs.

API reference

Default command

Run documentation doctests under docs/:

$ pytest docs/