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

Dieter Maurer dieter at handshake.de
Thu Apr 10 11:17:16 EDT 2008


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)
-- and got a "TypeError: set_trace requires at least one argument, 0 given".
Now, I know the "zpdb.set_trace()" does not want any arguments.
I moved the line from the doctest code into the failing infrastructure code --
same "TypeError".
I called "help(zpdb.set_trace)" and got:

Help on function set_trace in module zope.testing.doctest:

set_trace(self)

Apparently, "doctest" has overridden "zpdb.set_trace" in
an incompatible way....


I will rewrite my test as "unittest" and probably avoid in the future 
"zope.testing.doctest" whenever possible.



-- 
Dieter


More information about the Zope-Dev mailing list