Skip to main content

Doctest plugin for pytest with support for Sphinx-specific doctest-directives

Project description

Action Status

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.


  • 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”


  • pytest


You can install “pytest-sphinx” via pip from PyPI:

$ pip install pytest-sphinx



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.


Distributed under the terms of the BSD-3 license, “pytest-sphinx” is free and open source software


If you encounter any problems, please file an issue along with a detailed description.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pytest_sphinx-0.6.3.tar.gz (13.7 kB view hashes)

Uploaded Source

Built Distribution

pytest_sphinx-0.6.3-py3-none-any.whl (10.3 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page