[Python-Dev] Coverage Analysis of Python Code

Nick Monyatovsky mon at abaqus.com
Thu Mar 25 10:42:06 EST 2004


Hello,

I wonder if the technical experts in this group could answer the following
question: it is possible to perform coverage analysis on python (py) code?

Let me describe why we are looking for this. We use Python internally, and by
now people got quite fond of it. So fond in fact, that they would often prefer
to code in Python rather than C++ whenever they can. Thus, the body of the
Python code keeps growing and growing.

This is good, and this is bad. The bad part of it is that if there are errors
in the Python code, we will only find them when the execution path goes through
it.
We use pychecker, but it still does not help us catch all the errors, and many
of them sliop through and still show up at run-time. Obviously, the only
defense that remains is the thorough testing. This part is mostly left at the
discretion of individual programmers. Moreover, even if they are very careful
about unit-testing individual functions, there are always unforseen
permutations which can turn out fatal.

This is why we thought it would be really nice to have the ability to keep
track of the coverage of the ever growing body of the Python code that we use.
By this I mean only the .py/.pyc files. We have a fairly good technique for
tracking coverage in C/C++.

If such a detailed coverage is not possible, is there a way, at least, to get a
brief summary of what classes/methods/functions we have defined, where they are
being defined and where they are being called from?

Any pointers will be greatly appreciated.

Thank you,  -- Nick Monyatovsky -- mon at abaqus.com



More information about the Python-Dev mailing list