unittest unpythonic? [Was: Re: Tidying up]
Jo Vermeulen
jo at lumumba.luc.ac.be
Tue Apr 26 00:10:47 BST 2005
Op 26-apr-05 om 01:27 heeft Jason Diamond het volgende geschreven:
> 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 grouping?
>
> 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. :-)
I agree having tests that fail does encourage and motivate you more to
fix things.
Kind regards,
--
Jo Vermeulen <jo at lumumba.luc.ac.be>
http://lumumba.luc.ac.be/jo/
More information about the bazaar
mailing list