Code coverage to Python code

S

skip

Hussein> What is the best code coverage tool available for Python?

Probably Ned Batchelders coverage.py. There is a trace.py module which
comes with Python as well.
 
R

Roy Smith

Robert Kern said:

I was playing with Ned Batchelder's coverage.py module today. Once I
stopped screwing around trying to get the "easy install" stuff to work and
just copied the danged .py file to my site-packages directory, I was up and
running in a few minutes.

I suppose there's a lot of bells and whistles you could add, but it ran my
code and told me which lines had executed and which hadn't. That pretty
much seems like what you want a code coverage tool to do.

http://nedbatchelder.com/code/modules/coverage.html
 
D

David Stanek

I was playing with Ned Batchelder's coverage.py module today. Once I
stopped screwing around trying to get the "easy install" stuff to work and
just copied the danged .py file to my site-packages directory, I was up and
running in a few minutes.

I suppose there's a lot of bells and whistles you could add, but it ran my
code and told me which lines had executed and which hadn't. That pretty
much seems like what you want a code coverage tool to do.

http://nedbatchelder.com/code/modules/coverage.html

It will show lines as covered when they are executed by the
interpreter. Class statements, function definitions, etc. can show up
as executed. Are you seeing other code show up as covered?

<shameless_self_promotion>
Recently I pushed a branch of an experimental project I am calling
Barbarian[0]. It uses nose, figleaf and pylint to generate HTML for a
project. A blog post with a more detailed description will be posted
within a few days.

[0] http://code.launchpad.net/~dstanek/+junk/Barbarian
</shameless_self_promotion>
 
J

James Mills

What is the best code coverage tool available for Python?

I like ot use nose with it's coverage plugin.

easy_install nose
easy_install co

And I use the following in my top-level Makefile

tests:
@nosetests \
--with-coverage \
--cover-package=circuits \
--cover-erase \
--cover-inclusive \
--with-doctest


cheers
James
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top