[Python-Dev] doctest and pickle

R. David Murray rdmurray at bitdance.com
Sat Jun 8 20:17:14 CEST 2013

On Sat, 08 Jun 2013 19:54:18 +0200, =?UTF-8?Q?=C5=81ukasz_Rekucki?= <lrekucki at gmail.com> wrote:
> On 8 June 2013 17:41, Ethan Furman <ethan at stoneleaf.us> wrote:
> > On 06/08/2013 03:09 AM, Serhiy Storchaka wrote:
> >>
> >> Is it possible to add "invisible" code which doesn't displayed in the
> >> resulting documentation, but taken into account by
> >> doctest?
> >
> >
> > I have no idea.  This is my first time using doctest.
> >
> AFAIK, stdlib uses Sphinx, so you can provide a testsetup block[1]. At
> least if you're running them via Sphinx.

Running the doctests via Sphinx is still, I believe a Future Objective :).
I think we are getting close to being able to do that, though.  (Well,
you already can for Python2; but not, I think, for Python3).

If the test module from which you are importing is short, you could use
the Sphinx literalinclude directive to include the contents of the file
in the docs just before you show the 'is' example.  You could also explain
(briefly) *why* it is necessary to use an imported class for this example,
which IMO is useful information.


More information about the Python-Dev mailing list