[Python-Dev] Unit testing...

Jeremy Hylton jeremy@beopen.com
Thu, 13 Jul 2000 15:10:28 -0400 (EDT)

>>>>> "PP" == Paul Prescod <paul@prescod.net> writes:

  PP> Andrew Kuchling wrote:
  >>  ...
  >> (I've speculated about adding a unit testing framework, similar
  >> to the one we use internally at the MEMS Exchange; the discipline
  >> of using it makes writing a test more time-consuming, but the
  >> tests also wind up being more comprehensive.)

  PP> I think PyUnit/JUnit and friends are in vogue these days. There
  PP> is some virtue in having a framework that could be used also by
  PP> extension module writers so that there is some consistency about
  PP> finding and invoking tests.

I think there are several unit testing frameworks for Python.  Would
you be willing to survey the state of these projects and suggest one
for adoption?  I think the current regrtest script is a bit krufty;
it's certainly hard to read.

Two features I'd like to see in an improved testing framework are the
ability to test syntax errors, e.g. check that
    def foo(a):
        global a
raises a syntax error and does not dump core.

It would also be good to include tests for modules like httplib that
might fail for reasons that have nothing to do with the code itself.
(Perhaps one could finesse the issue by building a test suite using
the SimpleHTTPServer.)  I don't think there's a good way to report a
non-fatal error like, "couldn't run the httplib test because the
network appears to be down."