[docs] [issue15629] Add to regrtest the ability to run Lib and Doc doctests
report at bugs.python.org
Mon Sep 17 14:43:54 CEST 2012
Ezio Melotti added the comment:
> Documentation examples are meant to be read, not executed
I agree, but several of them already run, and others run with the addition of doctests directives (that are hidden in the html output). If the code needs to be changed in a way that is less readable, the test can just be skipped.
> Furthermore, spreading unit tests in the doc files instead of Lib/test
> files will make maintenance of tests more tedious as well.
Tests should be kept in Lib/test, this is mostly to make sure that the examples are correct. The examples in the docs should still be written with the goal to be clear for the user -- being valid doctests is a secondary goal.
Python tracker <report at bugs.python.org>
More information about the docs