[TIP] A rare philosophical thought

C. Titus Brown ctb at msu.edu
Sun Aug 3 08:35:57 PDT 2008


On Sun, Aug 03, 2008 at 03:56:55PM +0100, Michael Foord wrote:
-> Ben Finney wrote:
-> > "C. Titus Brown" <ctb at msu.edu> writes:
-> >> I HATE UNITTEST.
-> >
-> > I love the fact that it exists and works as advertised.
-> 
-> I like it. The oft-cited 'boilerplate' is usually an import and a class 
-> definition...

You are both experienced Python developers.  Greg Wilson and I both face
convincing people new to Python, new to programming, and new to testing
how to use unittest.  In that sense, the boilerplace is an obstacle.

Given that the boilerplate is in fact *boilerplate*, as both py.test and
nose show, I am unclear as to why there is active *support* for keeping
it.  Are you just being conservative ("hey! it works! why change it?"),
or do you really think it serves a purpose?

-> >> UNITTEST IS EVIL.
-> 
-> I'm aware of no justification for that statement...

What, are we Wikipedia all of a sudden?  [Source needed for morally
relativistic judgement; please supply.]  Yeesh :)

I think it's evil because the module, the docs and the required
boilerplate actively discourage people new to Python from testing.  It
certainly had that effect on me; only after I started using nose did I
begin to understand, and, to some extent, appreciate unittest.

Moreover, unittest is not very Pythonic.  Boilerplate is not Pythonic.
Unnecessary code is not Pythonic.  Over-complex basic frameworks is
unfortunately *somewhat* Pythonic (the TCP/Web stuff, anyone?) but I
don't think it's a good aspect of Python.

-> >> UNITTEST NEEDS TO BE REPLACED.
-> >
-> > Entirely agreed on this point. I think, though, that you'll find
-> > little immediate consensus on what to replace it with :-)
-> 
-> Personally I disagree - although there are obvious improvements that can 
-> be made.

I see widespread adoption of other unit testing frameworks (nose and
py.test).  Doesn't this argue that in fact there is a better way to do
it?  Why should we settle for unittest?

There are very few strong advocates for the current unittest, which is a
red flag all of its own.  Or is this a misperception on my part?

--titus
-- 
C. Titus Brown, ctb at msu.edu



More information about the testing-in-python mailing list