Friday, October 15, 2004

python coverage tools

Some time ago, browsing source code for SQLObject, I found a decent module for code coverage analisys for python. It was hooked to the unittests' runner and in effect, provided you with a statistics on how much of the codebase were actually covered by these tests.

I decided to try out this idea on my project's test code and results were rather impressive. One of the problem with dynamic languages like Python is that you have to run a particular line of code to be sure that it doesn't contain some syntax error or a typo. Yes, the interpreter is able to detect some classes of errors upon the complication but far fewer than, say, Java compiler. Code coverage, while it does not guarantee anything about the code's behaviour (whether it's correct or not) at least tells you what was and what wasn’t executed. And for Python that's of double importance.

Now I'm hooked to the idea and pondering about the option to start and keep a coverage database. This should be even more helpful, as I could track the metric over time.

PS: I've also found an Apycot package from Logilab, which contains a whole suite of testing tools, including coverage, lint and more. Unfortunately, it's not very well decoupled from the logilab's internal development process and hence hard to configure. And it's not Windows-aware (where I happen to develop now).

Apart from the rather old (2001) coverage.py and logilab's project I didn't find a lot of other, metric-oriented tools for python. Any suggestions on what I have missed are welcome.

9 Comments:

Blogger Ian Bicking said...

Zope's test runner also can do code coverage. I'm sure they all use the same technique, and maybe some of the same code, so I don't know which one is better, or if there's really much difference.

8:06 PM  
Anonymous Anonymous said...

This comment has been removed by a blog administrator.

9:29 PM  
Anonymous Anonymous said...

This comment has been removed by a blog administrator.

11:16 PM  
Anonymous Anonymous said...

Hi, my name is alizee_bi
from United States
, i like your web site, very good job !
, my web site , my e-mail: alizee_bi@hotmail.com

4:44 PM  
Anonymous Anonymous said...

Hi, my name is sexy-girl
from United States
, Hi, my name is Gauge, i'love your Website. Very Good Job.
, my web site , my e-mail: gauge_amatrice@hotmail.com

12:13 PM  
Anonymous Anonymous said...

Hi, my name is britney_et_samantha
from United States
, Join The Orgie
, my web site , my e-mail: samantha_brinks@hotmail.com

2:36 PM  
Anonymous Anonymous said...

Hi, my name is bimbo
from United States
, Download The Video Paradise Here !
, my web site , my e-mail: cyntia_bimbo@hotmail.com

5:27 PM  
Anonymous Anonymous said...

Hi, my name is http://alizeevideosx.free.fr
from alizee_bimbo
, hi, your site is very good, please look at mine too !
, my web site , my e-mail: United States

8:26 PM  
Anonymous Anonymous said...

Hi, my name is divx videos x
from United States
, hello !
, my web site , my e-mail: divx.videos.x@sexbot.com

9:18 PM  

Post a Comment

<< Home