[Python-Dev] Testing documentation snippets

Georg Brandl g.brandl at gmx.net
Sat Mar 22 13:08:54 CET 2008


Hi,

the newest version of Sphinx supports testing doctest (and other) snippets
in the documentation.  Since we have many examples in the docs that may
get out of date, I think this is a valuable thing to have.

I've started making the doctests runnable with Sphinx in three documents;
the functional howto, the RE and the Decimal docs.

If you want to know how to run the doctests, it should be as easy as

$ cd Doc
$ make doctest PYTHON=../python

on UNIX. The PYTHON=../python is needed to really test against the tree
version of Python, not the system-wide installed one.

If you want to run only tests in one source file, run

$ make doctest PYTHON=../python SOURCES=library/decimal.rst

If there is further interest in this, I'll explain the details how to
"activate" examples to work with "make doctest".

Georg

-- 
Thus spake the Lord: Thou shalt indent with four spaces. No more, no less.
Four shall be the number of spaces thou shalt indent, and the number of thy
indenting shall be four. Eight shalt thou not indent, nor either indent thou
two, excepting that thou then proceed to four. Tabs are right out.



More information about the Python-Dev mailing list