Michael Tobis wrote: > It appears that doctest does not work straightforwardly within iPython. > > I would like to be able to use doctest within a file conditionally, so > that I can develop it within ipython and test it otherwise. > > It would seem that this would work: > > Python 2.4.1 (#2, Mar 31 2005, 00:05:10) > [GCC 3.3 20030304 (Apple Computer, Inc. build 1666)] on darwin > Type "help", "copyright", "credits" or "license" for more information. > >>>>import testme >>>>testme._test() >>>> > > but it doesn't (the test above fails, but reports nothing)
IPython replaces sys.displayhook(), the function that determines how an object gets printed when it is the result of an expression in the interactive interpreter. Consequently, if you write your doctests as if they were executed from the virgin interpreter, then you will get different values if you run the tests in IPython. And vice versa. Writing for IPython and executing for IPython may or may not work. -- Robert Kern [EMAIL PROTECTED] "I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth." -- Umberto Eco -- http://mail.python.org/mailman/listinfo/python-list