[Python-Dev] Unit testing (again)

Tim Peters tim.one@home.com
Mon, 12 Feb 2001 21:05:51 -0500


Note that doctest.py is part of the 2.1 std library.  If you've never used
it, pretend I didn't tell you that, and look at the new std library module
difflib.py.  Would you even guess there *are* unit tests in there?  Here's
the full text of the new std test test_difflib.py:

import doctest, difflib
doctest.testmod(difflib, verbose=1)

I will immodestly claim that if doctest is sufficient for your testing
purposes, you're never going to find anything easier or faster or more
natural to use (and, yes, if an unexpected exception is raised, it doesn't
stop the rest of the tests from running -- it's in the very nature of "unit
tests" that an error in one unit should not prevent other unit tests from
running).

practicing-for-a-marketing-career-ly y'rs  - tim