[Python-3000] doctests vs. unittests (was Re: pimp; restructuring the standard library)
Fred L. Drake, Jr.
fdrake at acm.org
Thu Jun 28 22:20:31 CEST 2007
On Thursday 28 June 2007, Chris McDonough wrote:
> a) If one of your fixture calls or an assertion fails for some
> reason, the rest of the test
> trips over itself trying to complete, usually without success
> because an invariant
> hasn't been met, and you need to scroll through a bunch of decoy
> output to
> see where the actual problem began.
The testrunner in zope.testing handles this by providing an option to hide the
secondary failures, so only one traceback shows up per document.
> b) I often use test bodies as convenient points to put a
> pdb.set_trace call if I want to
> debug something. This wasn't very well supported when I was
> trying to use doctest.
The doctest in zope.testing supports this; hopefully someone sufficiently
in-the-know can unfork that version.
> As a result, I still use unittest pretty much exlusively to write
> tests. I'd be sad if it went away.
Yes; there's definately a place for unittest, or something very like it.
-Fred
--
Fred L. Drake, Jr. <fdrake at acm.org>
More information about the Python-3000
mailing list