[Chicago] is it possible to execute __future__ statements in doctest?

Kumar McMillan kumar.mcmillan at gmail.com
Tue Mar 17 22:39:37 CET 2009


Specifically, I'm using sphinx doctest and trying to do development in
python 2.5.  I'd like to put with statement examples in my doctests
but that requires from __future__ import with_statement at the top of
a file to alter the compiler.

Is there a way to put __future__ statements in doctest or send
compiler options to doctest?  I couldn't find anything in the doctest
docs about it but a google search turned up an accepted patch to
python from 2001 that claims to allow interactive shells to use
compiler flags.

My lame work around is this:

.. doctest::
    :options: +SKIP

    >>> with some_context(): # doctest: +SKIP
    ...

then uncommenting it for 2.6 :(


More information about the Chicago mailing list