pytest-doctestplus
Pytest plugin with advanced doctest features.
Decision gist · record as of 2026-08-14
Yes. This is a mature, actively maintained plugin (Production/Stable) with low install friction and no known vulnerabilities. Install it if you write documentation with code examples and want to ensure those examples stay correct. The floating-point comparison and remote-data features address real pain points in scientific and technical documentation testing.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Python 3.10 or later.
- Low friction install with only pytest and packaging as runtime dependencies.
- Actively maintained with recent commits and stable releases; last update 200 days ago with ongoing development.
License · maintenance · safety
BSD (permissive) — BSD license (permissive) means you can use this freely in commercial and open-source projects with minimal restrictions.
last release 2026-01-26 (200 days) · last repo commit 2026-08-02 · 119 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 678,215 downloads/mo, #5,377 on PyPI
Alternatives
Verify before relying
pip install pytest-doctestplus
# In your test file or docstring:
# >>> 1.0 / 3.0 # doctest: +FLOAT_CMP
# 0.333333333333333311
# Run with: pytest --doctest-plus --doctest-glob '*.md'- Whether the plugin handles all edge cases in Markdown fenced code blocks consistently across different markdown parsers.
- Performance impact when running doctests on very large documentation sets or projects with thousands of examples.
What it is and what it does
pytest-doctestplus extends pytest's built-in doctest support to handle example code in Python docstrings and standalone documentation files (RST, Markdown, TeX). It solves the problem of testing documentation examples that may have floating-point precision variations, need to skip certain tests, or depend on remote data—situations where standard doctests fail or require workarounds.
The plugin integrates directly into pytest's collection and execution pipeline. You enable it via command-line flags (--doctest-plus, --doctest-rst, --doctest-ufunc) or configuration, then write doctests using standard Python doctest syntax plus optional directives like +FLOAT_CMP for approximate numeric comparison, +IGNORE_WARNINGS to suppress warnings, or +SHOW_WARNINGS to display them. It respects pytest's standard doctest options and can work alongside pytest-remotedata for tests that fetch external resources.
Use it for
- Test code examples in Sphinx documentation to ensure they remain correct as the library evolves.
- Validate Markdown README files and tutorials contain working Python code snippets.
- Compare floating-point numerical results in doctests without brittle string matching on roundoff digits.
- Skip doctests in specific classes or functions during CI without removing the documentation examples.
- Test NumPy ufunc docstrings that contain example code requiring special handling.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes.
This is a mature, actively maintained plugin (Production/Stable) with low install friction and no known vulnerabilities. Install it if you write documentation with code examples and want to ensure those examples stay correct. The floating-point comparison and remote-data features address real pain points in scientific and technical documentation testing.
Install
pytest-doctestplus on PyPI
Before you install
Low friction install with only pytest and packaging as runtime dependencies. Actively maintained with recent commits and stable releases; last update 200 days ago with ongoing development.
Requires Python 3.10 or later.
License in practice
BSD license (permissive) means you can use this freely in commercial and open-source projects with minimal restrictions.
Quickstart
pip install pytest-doctestplus
# In your test file or docstring:
# >>> 1.0 / 3.0 # doctest: +FLOAT_CMP
# 0.333333333333333311
# Run with: pytest --doctest-plus --doctest-glob '*.md'
Verify before relying
- Whether the plugin handles all edge cases in Markdown fenced code blocks consistently across different markdown parsers.
- Performance impact when running doctests on very large documentation sets or projects with thousands of examples.
Package facts
| License | BSD permissive |
| Python support | Supports the current Python release >=3.10 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 2 packagespytestpackaging |
| Maintenance | Actively maintained 200 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 678,215 / month, #5,377 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 5 - Production/StableFramework :: PytestIntended Audience :: DevelopersLicense :: OSI Approved :: BSD LicenseOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: Implementation :: CPythonTopic :: Software Development :: TestingTopic :: Utilities |
Evidence: pytest_doctestplus-1.7.1-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “doctest rst markdown files”
- pytest-doctestplusA pytest plugin that runs doctests in Python docstrings and…
- sybil-extrasProvides specialized evaluators and parsers that extend Sybil, a…
- rstcheckValidates reStructuredText syntax and checks code blocks nested…
Give your agent the search over MCP, or paste the wish link into any chat.
More Utilities packages
Converts domain names between Unicode and ASCII-compatible encoding (Punycode) according to IDNA 2008 and Unicode Technical Standard 46, with security validation and broader script coverage than the standard library.
Install it if you work with internationalized domain names, need to validate domains, or use HTTP clients that depend on it transitively.
Detects and normalizes text encoding from unknown or ambiguous sources, supporting all IANA character sets that Python's core library provides codecs for, with the ability to register custom codecs.
Setuptools is a Python build backend and package management tool that handles building, distributing, and installing Python packages, including support for C/C++ extension modules.
Pluggy provides a plugin system that lets you define hook specifications and register implementations to be called in sequence, enabling extensible Python applications without tight coupling.
Install it if you're building an extensible application or framework.
Pygments is a syntax highlighter that colorizes source code and text in over 500 languages and formats, outputting to HTML, LaTeX, RTF, SVG, images, or ANSI terminal sequences.
Install it if you need to display or transform source code.
Six provides utility functions to write Python code that runs on both Python 2.7 and Python 3.3+, smoothing over language differences between the two versions.
See also xdoctest · pytest-remotedata · pytest-cython · pytest-examples · pytest-astropy · pytest-codeblocks · pytest-filter-subpackage · mutmut · pytest-markdown-docs · flake8-rst-docstrings