[TIP] Test discovery for unittest

Robert Collins robertc at robertcollins.net
Fri Apr 10 15:46:16 PDT 2009


On Fri, 2009-04-10 at 18:32 +0100, Michael Foord wrote:

> Doctest how I loathe thee:
> http://www.voidspace.org.uk/python/weblog/arch_d7_2008_10_25.shtml#e1022
> 
> A list of reasons from my experiences of testing ConfigObj with
> doctest:
> http://www.voidspace.org.uk/python/weblog/arch_d7_2008_01_12.shtml#e920
> 
> Why doctest makes poor unittests:
> http://andrew.puzzling.org/diary/2008/October/24/more-doctest-problems
> 
> Minor comments from me (particularly missing assert methods):
> http://www.voidspace.org.uk/python/weblog/arch_d7_2008_10_25.shtml#e1023
> 
> Michael

I like two things about doctest:
When I *am writing documentation* it is useful to make sure the examples
work.

The string pattern matching is very pithy. Some time ago I figured out
how to glue this into unittest as an assertion, but I managed to lose
the glue and haven't gotten around to glueing it back in again:(.

I don't like doctest for TDD because TDD doesn't follow a narrative.
When I've watched folk TDD with doctest they tend to end up with just
integration or acceptance tests, and little else :(.

-Rob
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part
Url : http://lists.idyll.org/pipermail/testing-in-python/attachments/20090411/c0adc3df/attachment.pgp 


More information about the testing-in-python mailing list