<div dir="ltr"><div style="font-size:12.8px"><span style="font-size:12.8px">I'd asked this of Robert Bradshaw earlier and was pointed in this direction (specifically towards Stefan), so here goes!</span></div><div style="font-size:12.8px"><span style="font-size:12.8px"><br></span></div><div style="font-size:12.8px"><span style="font-size:12.8px">I'm having trouble with getting Cython to play nicely with the coverage.py tool via the Cython.Coverage plug-in.</span><br></div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">We have tests that are running from a different setup.py project than the one which contains the Cython files (the projects respectively being for the duration of this discussion the 'tests' project and the 'source' project). The generated coverage file contains the line data for individual .pyx files, but the paths of the .pyx files themselves <i>within</i> the .coverage file appear to be rooted in the tests project <!--
-->rather than the site-packages folder in which the source project's files were installed (i.e. paths that never exist throughout the edit-build-test cycle).<div><br></div><div>After editing the .coverage file manually to point to the source project directory, coverage.py reports that the .pyx files are not python files and errors out... but the .coveragerc file contains the plug-in module via `[run]\n plugins = Cython.Coverage`, so I'd have expected the Cython coverage.py plug-in to catch those files and handle them instead of letting the rest of coverage.py get confused over them.</div><div><br></div><div>Furthermore, this is against the 4.0 coverage.py release rather than the 4.0b2 coverage.py release (which appears to be the version against which the latest edit to the Cython code base was made). I don't see any API differences between the two in the plug-ins, but I might have missed something so maybe that's relevant.<br><div><br></div><div>A secondary issue<!--
-->: the .pyx files are never copied over to the installation directory, so even if the paths were 'correct' (with respect to being copied into the site-packages folder or being accessible via developer mode pip-installs), they wouldn't be found. This seems like it wouldn't necessarily be an issue from a cursory glance at the source code as the file tracer in the Cython coverage.py plug-in appears to spit out blank lines in such a scenario.</div></div><div><br></div><div>Complicating matters further, we're running the tests through pytest. That said, I've given up on trying to get pytest-cov to play nicely with this until I can get a manual invocation of `coverage report ...` to produce output describing the .pyx files.</div><div><br></div><div>Thanks for reading this far. Got any pointers?</div><div><br></div><div><br></div><div>----------------<span style="font-size:12.8px">----------------</span><span style="font-size:12.8px">----------------</span><!--
--><span style="font-size:12.8px">----------------</span></div><div><div style="font-size:small"><span style="font-size:12.8px">Context: </span><span style="font-size:12.8px"><a href="https://github.com/soltanmm/grpc/tree/cy-wip/src/python">https://github.com/soltanmm/grpc/tree/cy-wip/src/python</a></span></div><div style="font-size:small"><span style="font-size:12.8px">Basic steps to run the tests:</span></div><div style="font-size:small"><ul><li style="margin-left:15px"><span style="font-size:12.8px">cd $GRPC_REPOSITORY_ROOT</span></li><li style="margin-left:15px"><span style="font-size:12.8px">make</span></li><li style="margin-left:15px"><span style="font-size:12.8px">CONFIG=opt ./tools/run_tests/build_python.sh 2.7</span><br></li><li style="margin-left:15px"><span style="font-size:12.8px">CONFIG=opt PYVER=2.7 ./run_tests/run_python.sh</span></li></ul></div></div></div></div>