unittest.main-workalike that runs doctests too?

Chris Lambacher chris at kateandchris.net
Sat May 6 23:57:59 EDT 2006


On Fri, May 05, 2006 at 06:47:26PM +0100, John J. Lee wrote:
> Jay Parlar <jparlar at cogeco.ca> writes:
> > On May 5, 2006, at 6:35 AM, John J. Lee wrote:
> [...]
> > > I know about nose, but it seems just a little too magical for my
> > > tastes, and includes stuff I don't really need.
> [...]
> > nose actually has very little magic, its operation is quite 
> > straightforward. I've played with its codebase before, and it's quite 
> > clean.
> 
> Maybe (but note I *was* talking about what it does, not the
> implementation of same).
> 
I don't know what you think is magic about what it does.  The documenation is
very clear about how tests are found and how you integrate with doctest.  Its
'native' test structure is way easier to use than doctest or unittest and it
integrates with both.

> 
> > And the new 0.9 branch uses a plugin system for some of the extra 
> > functionality, so you don't even have to install all the things it's 
> > capable of doing.
> 
> Still seems a little OTT to require another library just to find the
> tests.
I did not need to install anything extra to make it work.  I did eventually
install Ned Batchelder's coverage.py, but I decided to do that even before
realising that nose had support for it.

I like nose a lot because its tests are so easy to set up.  At a basic level
all you need are functions prefixed with test.  Assert a a condition, if the
assertion fails, the test fails.

Also installation is really easy.  It's in the Cheese Shop so easy_install will
find it, or you can go with the tradition python setup.py install.

-Chris



More information about the Python-list mailing list