[Cython] Cython coverage and multiple projects
stefan_ml at behnel.de
Sat Oct 10 17:27:47 CEST 2015
Masood Malekghassemi via cython-devel schrieb am 08.10.2015 um 01:06:
> 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).
This seems to be a rather unusual setup. The "expected" setting is that
tests live somewhere within the source checkout and are run on the
non-installed sources, usually as part of the CI build process, sometimes
even just as part of a separate reporting process. Why do you want to
create coverage reports after the installation?
> 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.
Sure, that's a difference from .py/.pyc files which are getting executed
directly. For Cython code, there is an additional compile/build step that
generates the executable code from the sources, which are then no longer
needed. That's another reason why support for coverage reporting after the
installation seems foreign here and wouldn't be of much use.
So, my suggestion would be to run the coverage reports within the source
tree after building it, when all source files are readily available. But
I'm obviously missing a lot of information about your actual project setup
and the reasons behind what you are doing here.
More information about the cython-devel