code coverage tool

A. Lloyd Flanagan alloydflanagan at attbi.com
Thu Feb 27 11:40:18 EST 2003


philh at cabalamat.uklinux.net (phil hunt) wrote in message news:<slrnb5qtiu.q2.philh at cabalamat.uklinux.net>...
> On Thu, 20 Feb 2003 07:35:06 -0500, Peter Hansen <peter at engcorp.com> wrote:
> >phil hunt wrote:
> >> 
> >> Is there an open-source code coverage tool for Python? I have a
> >> program for which I have written sevewral unit tests, and I want to
> >> see if any of the lines in my program aren't being exercised by the
> >> tests.

Check out
http://www.garethrees.org/2001/12/04/python-coverage/.
I use it extensively.  It has a few problems. (For example, don't use
c or t for global names in your code!).  However it generally works
very well.

here's a sample output:

> coverage.py -rm ShellScriptModule.py
Name                Stmts   Exec  Cover   Missing
-------------------------------------------------
ShellScriptModule     111    108    97%   95-96, 213




More information about the Python-list mailing list