[issue15629] Run doctests in Doc/*.rst as part of regrtest

Ezio Melotti report at bugs.python.org
Sun Aug 12 16:35:34 CEST 2012


Ezio Melotti added the comment:

> If I understand correctly, do you mean for example that 
> Lib/test/test_textwrap.py could be responsible for loading
> the doctests in Doc/library/textwrap.rst?

One advantage of this is that I could explicitly add a test in test_textwrap.py that loads the doctests in textwrap.rst and runs them.
This would allow me to decide if those tests should be run or not, and which ones are runnable.  If I know that textwrap.rst has no runnable tests I won't add the test, so by simply running test_textwrap I would be running all the tests I want/need to run.

OTOH this has disadvantages too.  If the tests are loaded explicitly it means that every test file that wants to load the doctests should be modified.  Even if foo.rst has no runnable doctests and no test to load them is added to test_foo.py, a `make doctest` might still include the file unless we mark it in some way (either by a module-wide directive, or by marking all the individual snippets of code).

----------

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


More information about the Python-bugs-list mailing list