[TIP] unittest issues and development

Fernando Perez fperez.net at gmail.com
Wed Feb 10 15:22:04 PST 2010


On Wed, Feb 10, 2010 at 5:29 AM, Michael Foord
<fuzzyman at voidspace.org.uk> wrote:
> Thanks. I've assigned it to me. When I get a chance to look at it properly I
> will open up a discussion about it.

Greatly appreciated.

BTW, do you have any plans/interest in providing in unittest pep-8
compatible names, as well as top-level names for the various
assertions?  Nose.tools does that in a very simple but useful manner
that makes lightweight (non-class-based) tests really nice to write:

def test_foo():
  nose.tools.assert_equals(bar, baz, 'nice message)

The amount of code for this in nose.tools is tiny enough that I think
it would be nice to have it out of the box (and with proper pep8
names) in the stdlib.  With a trivial decorator like the ones I showed
you, these functions can even be seen by unittest as proper tests
without any of the nose discovery machinery.

Something like this would bring more of the light, friendly style of
nose testing into the realm of the stdlib, with (IMO) minimal overhead
of code.

The easier it is to write tests, the higher the chances I'll have of
convincing students to write them :)

Cheers,

f



More information about the testing-in-python mailing list