[IPython-dev] Doctest fixes, testing release out

Fernando Perez fperez.net@gmail....
Fri Sep 14 01:38:52 CDT 2007


OK, I think I got the bulk of this nasty mess.  Please update and
pound on it some more for a few days, and let me know how it goes.

On 9/13/07, Jörgen Stenarson <jorgen.stenarson@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()

Fixed.


> 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.

Fixed too.  There's now a function called doctest_reload() in genutils
which you can either put inside your scripts, or load and call
interactively as needed.  For example, if I change your example to:

def _test():
    import doctest
    from IPython.genutils import doctest_reload
    doctest_reload()
    doctest.testmod()

the output is now:


In [8]: run try_doctest.py
**********************************************************************
File "try_doctest.py", line 3, in __main__.a
Failed example:
    a(10)
Expected:
    11x
Got:
    11
**********************************************************************
1 items had failures:
   1 of   2 in __main__.a
***Test Failed*** 1 failures.

--------------------------- Another _test ----------------------------

**********************************************************************
File "try_doctest.py", line 3, in __main__.a
Failed example:
    a(10)
Expected:
    11x
Got:
    11
**********************************************************************
1 items had failures:
   1 of   2 in __main__.a
***Test Failed*** 1 failures.

In [9]:

As it should.

Let me know how it all goes...

Cheers,

f


More information about the IPython-dev mailing list