I'm trying to run coverage analysis on some Cython code using pytest-cov
and coveralls.io. I've got as far as building the extension modules with tracing enabled, and running the analysis with the help of the links below:
http://docs.cython.org/src/tutorial/profiling_tutorial.html
http://blog.behnel.de/posts/coverage-analysis-for-cython-modules.html
However, I'm getting some results that I can't explain. It seems that many of the def
/cdef
/cpdef
lines in the code are showing as not running, despite code within them being OK. The results aren't even consistent as some lines seem OK.
Example report: https://coveralls.io/files/1871744040
I don't know if I'm calling something wrong, if this is a bug, or if I'm just not interpreting the results correctly.
In the example above, the get_cost
method seems OK, but the __set__
method for the property above is not called, despite the lines within the function having been called.
Update: It seems the issue is with Cython classes. If the class is defined with def
rather than cdef
the problem goes away. I guess there isn't full support for this yet.