[Zope-dev] Re: [zope.testing.doctest] a nasty surprise
Balazs Ree
ree at ree.hu
Fri Apr 11 03:19:14 EDT 2008
On Thu, 10 Apr 2008 11:50:35 -0400, Benji York wrote:
> Dieter Maurer wrote:
>> As the community (apparently) strongly favors "doctest" over
>> "unittest", I wrote my first test based on "zope.testing.doctest". And
>> promptly, I was badly surprised....
>>
>> 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.
ipdb is a lightweight component that enables entering ipython when
"import ipdb; ipdb.set_trace()" is called. Those of you that use ipython
and also develop with doctests a lot, will understand why it would be a
nice to have also from doctests.
In case of ipdb I had no parameters problem like Dieter encountered with
zpdb, however I observed that the doctest runner needs to redirect input
and output while running tests, which are specifically routed back to
stdin and stdout while pdb.set_trace is entered, to enable interactivity.
This is done by monkeypatching pdb if I remember well. But the same does
not happen with ipdb, of course.
So, my conclusion is that while doctests work well with the standard pdb,
any alternate debugger must be supported explicitely (by changing the
doctest code). As with ipdb, this may be the case with zpdb as well.
Best wishes
--
Balazs Ree
More information about the Zope-Dev
mailing list