doctest or pyunit?

Fredrik Lundh fredrik at pythonware.com
Wed May 2 17:49:45 CEST 2001


Bruce Edge wrote:
> Is doctest going to be updated to use 2.1's method attributes rather than
> the doc string?

given that doctest is designed to make sure your *documentation*
is correct, that sounds like a really lousy idea ;-)

but it works well for unit-testing too: write a test program that
exercises relevant parts of your module, and use doctest to make
sure *that* program works as expected.

in my experience (having tried pyunit, several homebrewn frameworks,
including ports of the original smalltalk framework, greg's unittest, and
doctest), using doctest on test scripts beats all other approaches.
less code, less work, easier to debug the tests.  ymmv, as usual.

Cheers /F

<!-- (the eff-bot guide to) the standard python library:
http://www.pythonware.com/people/fredrik/librarybook.htm
     (electronic edition now available from amazon.com!)
-->





More information about the Python-list mailing list