I've been trying, and struggling to generate accurate coverage reports for our project's Cython files. It only seems to generate coverage reports for the lines that have interaction with python code. (not any lines which are translated to pure C). I do not know what else is happening or where this process is wrong.
The project uses meson-python as the build backend. One of the intended designs of the meson system is that it doesn't put built files in the source directories (meaning the transpiled C/C++ codes end up in a build directory). meson-python supports extension modules with in place building by installing hooks to the compiled codes that live in the build directory, (but by default these do not exist next to the transpiled code either). From what I understand the Cython.Coverage tool looks for the transpiled codes to live next to their source pyx files, therefore I've added a step that cythonizes (with '--directive linetrace=true') those sources again so that transpiled code ends up next to the pyx source. This process seems to allow coverage.py tool to find the correct c/cpp file.
During a coverage build, I tell meson to add the `--directive linetrace=true` directive to the cython project arguments, and `-DCYTHON_TRACE_NOGIL=1` to both the C and C++ project arguments. The commands that the ninja build executes "look" correct, for example. I've tried both `debug` and `release` meson builds, and neither makes a difference in the coverage.
And the coverage reported for the cython extensions.
As you can see it completely misses coverage of `simplex_helpers.pyx`, and the other files only report coverage on lines that had any (even the smallest) interaction with python.