1. Ned Batchelder
  2. coverage.py
  3. Issues
Issue #244 resolved

Coverage doesn't work with thread (not threading) module

Anonymous created an issue

I spent some time chasing why Coverage wasn't tracing my threads, returning 0 coverage for functions I knew were being hit (CTracer or pytracer, python 2.7, win7x64)

It turns out that, while Coverage works well with the threading module (Thread class), it doesn't trace threads created directly with the thread module. Wrapping my thread functions in threading classes fixed the issue.

My understanding is that using the thread module directly is being deemphasized so, rather than implementing support for this, it may be more an issue of documenting it somewhere (I didn't find any information mentioning this, found out by looking at Collector.py) and suggesting the workaround of wrapping the functions in Thread classes.

(and thanks for the great work! :) )

Comments (2)

  1. Log in to comment