collect and execute doctests from modules and test files.

Usage

By default all files matching the test*.txt pattern will be run through the python standard doctest module. Issue:

py.test --doctest-glob='*.rst'

to change the pattern. Additionally you can trigger running of tests in all python modules (including regular python test modules):

py.test --doctest-modules

You can also make these changes permanent in your project by putting them into a conftest.py file like this:

# content of conftest.py
option_doctestmodules = True
option_doctestglob = "*.rst"

command line options

--doctest-modules
run doctests in all .py modules
--doctest-glob=pat
doctests file matching pattern, default: test*.txt

Start improving this plugin in 30 seconds

  1. Download pytest_doctest.py plugin source code
  2. put it somewhere as pytest_doctest.py into your import path
  3. a subsequent py.test run will use your local version

Checkout customize, other plugins or get in contact.