[TIP] unittest & TDD
titus at caltech.edu
Sun Mar 11 07:39:00 PDT 2007
On Sun, Mar 11, 2007 at 08:35:32AM -0500, Atul Varma wrote:
-> On 3/4/07, Bob Ippolito <bob at redivi.com> wrote:
-> >I agree that unittest is straightforward, but it's annoying (on its
-> >own). Too much unnecessary cruft.
-> I agree. Out of curiosity, is there any movement towards making
-> py.test or nose a part of Python's standard library? The main reason
-> my company used unittest is, quite honestly, because we didn't look at
-> any other testing options when we started writing our unit tests,
-> assuming that the testing framework that shipped with Python was just
-> "the one way to do it" (a la Python's motto). We weren't huge fans of
-> its complexity (or rather, the boilerplate cruft caused by said
-> complexity), but we dealt with it. The fact that unittest was pretty
-> well documented helped a lot, too, but as soon as I saw py.test I had
-> wished I'd known about it before I started writing unit tests.
IMO this is partly a "release schedule" problem and partly a community
First, I don't get the impression that either nose or py.test are at a
stable resting point. I could be wrong.
Also, the py.test and nose feature sets seem to overlap quite a bit, but
the implementations are quite different. The two communities are both
fairly large at this point. This presents a conundrum akin to the Web
frameworks problem: if you've got a bunch of expertise invested in a
certain framework, switching is going to be bitch, so no one is going to
want to do it. Integrating e.g. nose into the stdlib would automatically
make nose the preferred unit testing framework, irritating the py.test
community ;). I think this sort of thing has been overcome (by
ignoring one community entirely?) in the past, but I'm not sure.
I don't have a good solution, although a feature comparison of py.test
and nose would be interesting.
Oh, and third, I'm not sure that either really needs to be there.
easy_install/setuptools makes life easy enough... just add a
'setuptools.require("nose==0.9.1")' into your package and you're done
More information about the testing-in-python