fredrik at pythonware.com
Fri Apr 15 10:33:05 BST 2005
> I think doctest can have a real value when you use it to make sure that
> the examples given for an API do work as intended. I hope that bzr will
> have a really good API for people to write workflow or bug tracker
> integration or similar things on top, and for that audience it's good to
> include examples in the API. (Particularly because Python APIs are not
> statically defined to the same extent as in C.) Beyond that I don't
> think doctest is so important.
> That said, one probably only wants a couple of examples at most for each
> entry point, which is not enough to thoroughly exercise it. There are
> probably too many at the moment.
> I think unittest is rather ugly and unpythonic, so I don't know if I'd
> really switch to that, but some tests in regular Python should be added.
the usual way to do this is to write one or more test programs, and use doctest
to make sure that the *test programs* work as documented.
(recent versions of doctests can run tests from other sources than python code,
but I prefer the test-the-test-program approach).
More information about the bazaar