unittest unpythonic? [Was: Re: Tidying up]

Jason Diamond jason at injektilo.org
Tue Apr 26 00:27:14 BST 2005

Martin Pool wrote:

>  I guess unittest is not all that bad, but it just seems a bit
>  dependent on defining lots of classes, which is more of a Java or
>  Smalltalk style than Python.

I used JUnit, CPPUnit, and NUnit before unittest so maybe that's why I 
don't see anything "wrong" with unittest. Technically, you only have to 
create one class to hold your test cases if that's all you need. But 
being able to group tests that rely on common set-up and tear-down code 
is not only convenient but necessary once your test suite gets past a 
certain size. What else would you want to use besides classes to do this 

As a way of getting up to speed on a project, I like to peruse the unit 
tests. When there aren't any (as there often aren't), I like to explore 
the code by writing unit tests for them. Would you be interested in 
those types of contributions?

Of course, the real benefit in writing unit tests comes when you write 
them before you write your code but writing them after the fact is still 
better than not having any at all. :-)

-- Jason

More information about the bazaar mailing list