A doctest plugin for pytest, which understands the sphinx-specific directives from doctest-sphinx. Those sphinx-specific directives can be used in rst files as well as in docstrings of python modules.
Features
support for the doctest directive
support for testcode and testoutput directives
support for testsetup and testcleanup is planned (pull-requests welcome)
support for parsing global optionflags (doctest_optionflags) from pytest.ini
support for :options: in testoutput
support for :skipif: in testcode and in testoutput
:hide: is ignored by “pytest-sphinx”
Requirements
pytest
Installation
You can install “pytest-sphinx” via pip from PyPI:
$ pip install pytest-sphinx
Usage
See doctest-sphinx. Have a look at the examples in doctest-examples.
Run pytest with the –doctest-modules flag.
Contributing
Contributions are very welcome. Tests can be run with tox, please ensure the coverage at least stays the same before you submit a pull request.
License
Distributed under the terms of the BSD-3 license, “pytest-sphinx” is free and open source software
Issues
If you encounter any problems, please file an issue along with a detailed description.
Metadata
Release files for pytest-sphinx 0.7.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pytest_sphinx-0.7.1.tar.gz | 13.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pytest_sphinx-0.7.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 24.0 kB
Release files / pytest_sphinx-0.7.1.tar.gz
| Download URL | pytest_sphinx-0.7.1.tar.gz |
|---|---|
| Size | 13.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
bdf45d96458e6aa1f3618c4845e60924eaa91244247c527eb88f58d6685dece6
|
|
BLAKE2b-256 checksum How to use checksums |
6c813c7e79f46228bbabdc836b3d2ef4adaa32559501055fdb02d40e4a6e7452
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jan 21, 2026.
Transparency logRelease files / pytest_sphinx-0.7.1-py3-none-any.whl
| Download URL | pytest_sphinx-0.7.1-py3-none-any.whl |
|---|---|
| Size | 10.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
fa943bb22c15569db02367b5b2b13ef3fbb9e534931ec193d480c05d956979fb
|
|
BLAKE2b-256 checksum How to use checksums |
dfeefc942ac27ad00ac71a5f5b1c8929bd49ff632d2c3dd30f07b552280bd4c8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jan 21, 2026.
Transparency log