[Zope3-Users] Re: [Zope] Debugging doctests

Benji York benji at zope.com
Thu Feb 23 10:10:18 EST 2006


Stephan Richter wrote:
 > On Thursday 23 February 2006 08:13, Lennart Regebro wrote:
 >
 >>As you see, I can't even step into that next line. And even if I
 >>could, the necessity of having to step through the doctestrunning
 >>would be a major pain in the ass.
 >
 > Ok, I have never needed this. And I can see why it does not work.
 > Every doctest line is its own expression. I personally can live with
 > that limitation. As I said, I have never needed this.

On the rare occasions when I have wanted to do that, I just make
whatever I want to step through into a single doctest line, like so:

 >>> a = 1
 >>> b = 2
 >>> c = a + b

Becomes

 >>> if 1:
...     import pdb;pdb.set_trace()
...     a = 1
...     b = 2
...     c = a + b

Ugly, but it works.  I too would like it if a "bare" set_trace() would
allow you to step through a doctest, but don't know if anyone is
sufficiently motivated to figure out the details (or a suitable
alternative).
-- 
Benji York
Senior Software Engineer
Zope Corporation


More information about the Zope3-users mailing list