[Zope-dev] Re: [zope.testing.doctest] a nasty surprise

Dieter Maurer dieter at handshake.de
Fri Apr 11 12:50:15 EDT 2008


Balazs Ree wrote at 2008-4-11 09:19 +0200:
> ...
>>> In order to analyse a difficult problem, I added "from dm.pdb import
>>> zpdb; zpdb.set_trace()" in the doctest ("dm.pdb.zpdb" is my Zope aware
>>> PDB extension)
>> 
>> The standard PDB works fine.  I'm sure you're extended version can be
>> tweaked to as well.
>
>I have similar issues with ipdb. - similar in sense that I cannot use it 
>when running from doctests.

Any any other debugger, too, will have problems.


Usually, I am no fan of "explicit is better than implicit".
But, in this case, I think it would give a much better solution.

Apparently, the debugger integration works by wrapping
some class ("_OutputRedirectingPdb") around a given debugger
and then use this debugger instead of the wrapped on.

How about documenting this wrapping class.
Then any debugger author can use the class to wrap his
debugger and use it.


For this special case, we do not need monkey patching.

    import myWrappedDebugger; myWrappedDebugger.set_trace()

    (or for the standard debugger:
    "from zope.testing import pdb; pdb.set_trace()")

is only slightly more complex than

    import pdb; pdb.set_trace()



-- 
Dieter


More information about the Zope-Dev mailing list