[pytest-dev] pytest-cov +gevent reporting incorrect results

Ofer Nave onave at dyn.com
Wed Apr 17 15:48:49 CEST 2013


Anyone have experience using pytest-cov on a codebase that makes use of 
gevent greenlets?

I just started using pytest-cov for the first time yesterday, and 
thought it'd be fun to try to get my test coverage from 85% to 100%.  
However, the last few reportedly not-covered lines are, in fact, 
executed multiple times.  I'm 100% certain of this (it's a critical 
section, the whole system depends on it, and I've added print statements 
just to be dumbly sure).

The only possibility that comes to mind is that perhaps this is because 
those sections of code are in a spawned greenlet, and maybe that messes 
with how pytest-cov works -- can't be sure because I don't know how it 
works.  :)

-ofer


More information about the Pytest-dev mailing list