[IPython-dev] Doctest fixes, testing release out

Fernando Perez fperez.net@gmail....
Sun Aug 12 19:28:36 CDT 2007


Hi all,

over time, there have been repeated reports of doctest not working
when running under IPython.  I think I finally fixed it deep enough
that things should now work correctly in all cases, so that you can
run any script or test suite that calls the various doctest testing
runners, when inside ipython, and everything should just work.  If you
are on SVN just update, or grab a testing release that I just made
from current SVN here:

http://ipython.scipy.org/dist/testing/

I need these publicly available for a conference this week, and they
wrap up all the recent fixes.  We'll start thinking about a release
soon, but for now this will do.


I should also mention that there's a new magic, %doctest_mode, that
toggles you in and out of a mode where the prompts are
doctest-compliant, and where you can paste into the interactive
session code with '>>>' prompts (including leading whitespace).  The
doctest profile is not really needed anymore, since you can just
switch at runtime into this mode from a normal ipython session without
having to restart, and you can switch out again to the normal In[]
prompts as needed.  Note that even though you don't see the numbered
prompts, they continue to exist:

In [20]: 2**4
Out[20]: 16

In [21]: %doctest_mode
Exception reporting mode: Plain
Doctest mode is: ON
>>> _20+99
115
>>> %doctest_mode
Exception reporting mode: Context
Doctest mode is: OFF

In [24]: Out.keys()
Out[24]: [1, 3, 4, 9, 14, 16, 19, 20, 22]

In [25]: _22
Out[25]: 115


Between SnakeOil and the new doctest support, ipython should now be a
good system for workflows that rely heavily on doctests.  Please
report any problems you may find with this...

Cheers,

f


More information about the IPython-dev mailing list