Coverage Analysis

Stidolph, David stidolph at
Tue Feb 8 22:20:57 CET 2000

Is there any way to do coverage analysis in Python?

While the Python system will check for overt syntax errors (tabs vs spaces
and missing ':' or unmatched quotes), it doesn't handle misspelled names
until the line is executed.

Is there a mode in Python to do coverage analysis - that is to track the
number of times a given line is executed.

What would be cool is a debug mode that would have an integer associated
with every line of every file executed.  All counts are initialized to zero.
As a line is executed the count is bumped up by one.  At some point you can
dump a module's couts to a file or as a tuple of integers.

Is there any way to hack this in?  Ideas??

Also, this might give more insights into where to put optimizations...

David Stidolph.

More information about the Python-list mailing list