[Cython] Cython coverage and multiple projects
atash at google.com
Thu Oct 8 01:06:01 CEST 2015
I'd asked this of Robert Bradshaw earlier and was pointed in this direction
(specifically towards Stefan), so here goes!
I'm having trouble with getting Cython to play nicely with the coverage.py
tool via the Cython.Coverage plug-in.
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 *within* 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).
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.
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.
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.
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.
Thanks for reading this far. Got any pointers?
Basic steps to run the tests:
- cd $GRPC_REPOSITORY_ROOT
- CONFIG=opt ./tools/run_tests/build_python.sh 2.7
- CONFIG=opt PYVER=2.7 ./run_tests/run_python.sh
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the cython-devel