Coverage works well, and I want it to properly measure any Python program, but there are some situations it can’t cope with. This page details some known problems, with possible courses of action, and links to bug reports with more information.

I would love to hear from you if you have information about any of these problems, even just to explain to me why you want them to start working properly.

If your problem isn’t discussed here, you can of course search the bug tracker directly to see if there is some mention of it.

Things that don’t work

There are a number of popular modules, packages, and libraries that prevent from working properly:

  • execv, or one of its variants. These end the current program and replace it with a new one. This doesn’t save the collected coverage data, so your program that calls execv will not be fully measured. A patch for is in issue 43.
  • multiprocessing launches processes to provide parallelism. These processes don’t get measured by Some possible fixes are discussed or linked to in issue 117.
  • gevent, which is based on greenlet, and is similar to eventlet. All of these manipulate the C stack, and therefore confuse Issue 149 has some pointers to more information.
  • thread, in the Python standard library, is the low-level threading interface. Threads created with this module will not be traced. Use the higher-level threading module instead.
  • sys.settrace is the Python feature that uses to see what’s happening in your program. If another part of your program is using sys.settrace, then it will conflict with, and it won’t be measured properly.

Things that require –timid

Some packages interfere with coverage measurement, but you might be able to make it work by using the --timid command-line switch, or the [run] timid=True configuration option.

  • DecoratorTools, or any package which uses it, notably TurboGears. DecoratorTools fiddles with the trace function. You will need to use --timid.

Really obscure things

  • Python 2.5 had a bug (1569356) that could make your program behave differently when being measured with coverage. This is diagnosed in issue 51.

Still having trouble?

If your problem isn’t mentioned here, and isn’t already reported in the bug tracker, please get in touch with me, we’ll figure out a solution.

« Previous: Contributing to Next: FAQ and other help »