[SciPy-Dev] Measuring test coverage of a Cython module
Lars G.
lagru at mailbox.org
Mon Mar 26 14:11:08 EDT 2018
Hi,
I'm trying to measure the test coverage of a Cython module. However the
module in question (`scipy/signal/peak_finding_utils.pyx`) doesn't show
up in the final report.
What I have tried so far:
1. Added `plugins = Cython.coverage` to the `.coveragerc` file.
2. Added
# cython: linetrace=True
# distutils: define_macros=CYTHON_TRACE_NOGIL=1
to the header of `peak_finding_utils.pyx`
3. Build binaries inplace with
$ python setup.py build_ext --inplace
4. Measured test coverage
a) with `runtests.py`
$ python runtests.py -t scipy/signal/tests/test_peak_finding --no-build
--coverage
b) and using the `coverage` package
$ coverage run -m pytest scipy/signal/tests/test_peak_finding.py
$ coverage html
This approach is based on this blog post:
http://blog.behnel.de/posts/coverage-analysis-for-cython-modules.html
In both cases a) and b) the PYX file sadly isn't included in the report
and I don't know what to try next. Has anyone figured out a way to do
this? If I've overlooked a related issue or conversation on the mailing
list I apologize and would be grateful if you could point me to it.
Best regards,
Lars
More information about the SciPy-Dev
mailing list