Unit Testing in Python

Roy Smith roy at panix.com
Thu Feb 10 21:34:06 EST 2005


In article <1108087841.271630.228970 at o13g2000cwo.googlegroups.com>,
 "rhat" <fakeadmin at gmail.com> wrote:

> Hi Everyone,
> I've recently been reading some articles about unit-testing in Python
> [1] [2], but I am a bit confused: where do I go to get started with
> this? I tried googling for "unittest" but all I've found are some old
> links to projects that already use it, and the older (as the articles
> put it) PyUnit project. I'm sorry if this is a obvious question or one
> that has already been answered, but unit-testing sounds interesting and
> I'm not sure where to start.
> 
> Thanks,
> Ryan Kaulakis

PyUnit is indeed what I use.  It's included in current distributions as the 
"unittest" module.

The module docs aren't perfect (especially when it comes to the big 
picture), but there's a good tutorial at 
http://diveintopython.org/unit_testing/index.html

Once you get your head around how it works, it's really quite simple to 
use.  It also has the advantage of being one of a series of "X-unit" 
packages for different languages (Junit, C++Unit, etc) which all have the 
same organization (with allowances made for language-specific 
requirements).  This means once you've learned one, you've got a big head 
start one learning another one.



More information about the Python-list mailing list