[TIP] Best way to do setup/teardown on a per-test basis using doctest?

Brett Cannon brett at python.org
Sat Jun 30 15:59:33 PDT 2007


On 6/30/07, Michael Foord <fuzzyman at voidspace.org.uk> wrote:
> Brett Cannon wrote:
> > There was an email to python-3000 recently from someone saying that we
> > should convert all unit tests for Python and its standard library over
> > to doctest.
>
> Hello Brett,
>
> I'm sure someone will answer your specific question, but I hope the
> suggestion to convert *all* Python tests over to doctest is not being
> accepted without debate.
>

It's been thoroughly shot down.  People in powerful places realize
that unittest and doctest each have their place.

> Whilst I'm sure what you want can be done with doctest, it seems to
> offer little advantage in the general case other than forcing your tests
> to be inside strings and use lots of angle brackets!
>

Well, if that turns out to be the case then that is fine.  I don't
have to do the tests in doctest.  I alrady have a set of tests in
unittest but I was thinking of converting them plus making sure they
were more along the lines of regression tests.

-Brett



More information about the testing-in-python mailing list