On Thu, Apr 10, 2008 at 08:46:15PM +0200, Dieter Maurer wrote:
> Benji York wrote at 2008-4-10 11:50 -0400:
> >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.
> 
> Does a documentation exist how "doctest" manipulates "set_trace"
> and what it expects that the manipulation succeeds.

Documentation?  Well, there are some comments in the source file...

doctest monkey-patches pdb.set_trace (in an ugly way, IMHO) to restore
sys.stdout, because you want the output from pdb commands like 'list' or
'print' to go to your console, and not to the doctest's actual result
StringIO collector.

> Apparently, "doctest" has replaced my "set_trace" in "zpdb"
> by its non working implementation of "set_trace".

I find it hard to believe.  It's more likely that zpdb is interacting
with pdb.set_trace in a way that conflicts with doctest's monkey-patch.

Is the zdpb module available on the web somewhere?

> I can understand that my "set_trace" would not have worked
> (as probably "sys.stdout/err" points somewhere else then usual),
> but I have difficulties to understand why "doctest"'s "set_trace"
> does not work (at all).

Marius Gedminas
-- 
...Unix, MS-DOS, and Windows NT (also known as the Good, the Bad, and
the Ugly).
                -- Matt Welsh

Attachment: signature.asc
Description: Digital signature

_______________________________________________
Zope-Dev maillist  -  Zope-Dev@zope.org
http://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope )

Reply via email to