[IPython-dev] Doctest fixes, testing release out

Fernando Perez fperez.net at gmail.com
Thu Sep 13 13:50:12 EDT 2007


On 9/13/07, Jörgen Stenarson <jorgen.stenarson at bostream.nu> wrote:

> Unfortunately it looks like you have missed some case(s)
>
> The following script demonstrates a problem
>
>
> # -*- coding: ISO-8859-1 -*-
> import sys
>
> def opa():
>      print sys.version
>
> opa()
>
>
> this script works properly when called with %run
> but subsequent calls of opa() from the prompt fails
> as shown below

Thanks a lot for this test, since it actually gives me a hint of what
the problems Darren was seeing with GUIs may be...



> A second problem is demonstrated below. Multiple calls to
> doctest.testmod() generates what look like a progess report on all calls
> after the first calls.
>
> At first I tried to fix this by adding a reload(doctest) (test by
> uncommenting case2). This doesn't work at all from the ipython prompt,
> it causes tests that used to work to fail. This feels like it could be
> related to the previous error.

No, that's because I monkeypatch doctest, and the reload() undoes the
monkeypatch.

> The solution seems to be to uncomment case 3 which resets a global
> variable in doctest.

Yup, that global in doctest is just a bad idea, since the entire
module is stateful.  Stupid design on their part...

I'll also try to address this, but the problem you uncovered earlier
is MUCH more serious.

Thanks again for giving me such a small, clear test, it will make things easier.

Cheers,

f



More information about the IPython-dev mailing list