[docs] [issue15629] Add to regrtest the ability to run Lib and Doc doctests

Chris Jerdonek report at bugs.python.org
Sat Sep 8 10:04:27 CEST 2012


Chris Jerdonek added the comment:

Attached is a patch that adds to regrtest the ability to run doctests in both library modules and documentation files (specifically, in the non-test modules in Lib/ and in the *.rst files in Doc/).

The syntax to run all doctests is--

    python -m test --doctests --docdir <path-to-doc>

If --docdir is left out, only module doctests are run.  You can run the doctests for individual files and modules by including test names of the form "fdoc:library/builtins.rst" and "mdoc:html.parser" (for file doctests and module doctests, respectively).

Doctests for a module are only run if the module has a variable `_doctest_safe` that evaluates to True.

I haven't yet added a mechanism to mark a documentation file as "doctest safe" or to skip importing a library module entirely (when running all tests).

----------
components: +Tests
keywords: +patch
title: Run doctests in Doc/*.rst as part of regrtest -> Add to regrtest the ability to run Lib and Doc doctests
Added file: http://bugs.python.org/file27146/issue-15629-1.patch

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue15629>
_______________________________________


More information about the docs mailing list