You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The issue seems to be rather complex. The more in-depth explanation follows at the end of the usual bug report content.
Describe the bug
A plugin's file_tracer method doesn't seem to get called with any file of a package that should be measured, but relevant files are showing up in the coverage report anyway, causing an error like this:
coverage.exceptions.DataError: Can't add file tracer data for unmeasured file 'C:\scripts\Bass4Py\Bass4Py\bass\bass.pxd'
To Reproduce
What version of Python are you using?
Python 3.8.2
What version of coverage.py shows the problem? The output of coverage debug sys is helpful.
What code shows the problem? Give us a specific commit of a specific repo that we can check out. If you've already worked around the problem, please provide a commit before that fix.
The issue is known to Cython's developers for quite a while now and i'm not sure where to even start searching and hope you can help me a bit further. The relevant issue can be found here: cython/cython#3515
The situation is as follows:
I set up everything correctly (I hope), means that I prepared everything Cython-wise first and set up a .coveragerc file next, as you can see in the bug report above. I then make sure to compile the project with debug enabled, allowing Cython to provide any information necessary for coverage / Cython.Coverage to work with. Running coverage afterwards yields the error shown above.
I started digging into the Cython.Coverage plugin and tried to debug the file_tracer method, which I think should be called for any possible file which can be measured, which deffinitely happens, but it only gets called with site-packages like pytest and others, but never gets called with files from my actual project and never returns an actual FileTracer object to coverage.py to further work with. I'm thus confused that coverage still found a .pxd file to work with, because I think that the Cython.Coverage plugin isn't responsible for that incident. I wasn't able to find any information where coverage was able to detect the pxd file, which is deffinitely correct, but since Cython.Coverage did never return a FileTracer object, coverage obviously doesn't know how to further trace this file type. I tried to track the issue down and ended up within the C Tracer and now think that I might find the issue much faster if I can get some help from you instead of debugging through that piece of the coverage project.
Since building the project i'm working on can be rather complicated due to external dependencies and such, I provided a debug build of the Cython module in question for Python 3.8 amd64 Windows and will try to attach it to this issue so that you can download and test with it if you like. GitHub doesn't allow attaching whl files however, so I provided a download link. Hope thats okay.
As I already mentioned, the issues seem to have started around the time of coverage getting updated to version 5.0. Those of you who are much more familiar with coverage and its history might know what changed during that update and thus be able to track down the issue much faster than me, I literally got into coverage about 2 days ago. Its probably just a matter of asking the right questions, but i'm not experienced enough to do so.
Steps to reproduce the issue:
Create a new virtual environment with Python 3.8
pip install -r requirements-dev.txt
pip install path/to/the/wheel/i/provided.whl
pytest --cov-config=.coveragerc --cov or coverage run -m pytest
I hope that I didn't forget anything, the problem kept me busy for quite a few hours now and I tried alot to track it down, just let me know if you need anything.
Thank you.
The text was updated successfully, but these errors were encountered:
In the meantime I made a change in coverage.py, does that improve things? I don't have a Windows machine to test on, but I can try the other reproduction instructions if they work on Linux.
The issue seems to be rather complex. The more in-depth explanation follows at the end of the usual bug report content.
Describe the bug
A plugin's file_tracer method doesn't seem to get called with any file of a package that should be measured, but relevant files are showing up in the coverage report anyway, causing an error like this:
coverage.exceptions.DataError: Can't add file tracer data for unmeasured file 'C:\scripts\Bass4Py\Bass4Py\bass\bass.pxd'
To Reproduce
Python 3.8.2
coverage debug sys
is helpful.pip freeze
is helpful.Timtam/Bass4Py@d02f095
Both ways, running either within pytest-cov and pure coverage, yield the same result. Either:
coverage run -m pytest
or
pytest --cov-config=.coveragerc --cov
Expected behavior
I'd expect coverage to properly measure my Cython code which should be enabled with the help of the Cython.Coverage plugin.
Additional context
i'm currently in the process of tracking down an issue that exists since approximately Coverage.py 5.0 with a plugin which allows Coverage to measure Cython code, which can be found here: https://github.com/cython/cython/blob/master/Cython/Coverage.py
The issue is known to Cython's developers for quite a while now and i'm not sure where to even start searching and hope you can help me a bit further. The relevant issue can be found here: cython/cython#3515
The situation is as follows:
I set up everything correctly (I hope), means that I prepared everything Cython-wise first and set up a .coveragerc file next, as you can see in the bug report above. I then make sure to compile the project with debug enabled, allowing Cython to provide any information necessary for coverage / Cython.Coverage to work with. Running coverage afterwards yields the error shown above.
I started digging into the Cython.Coverage plugin and tried to debug the file_tracer method, which I think should be called for any possible file which can be measured, which deffinitely happens, but it only gets called with site-packages like pytest and others, but never gets called with files from my actual project and never returns an actual FileTracer object to coverage.py to further work with. I'm thus confused that coverage still found a .pxd file to work with, because I think that the Cython.Coverage plugin isn't responsible for that incident. I wasn't able to find any information where coverage was able to detect the pxd file, which is deffinitely correct, but since Cython.Coverage did never return a FileTracer object, coverage obviously doesn't know how to further trace this file type. I tried to track the issue down and ended up within the C Tracer and now think that I might find the issue much faster if I can get some help from you instead of debugging through that piece of the coverage project.
Since building the project i'm working on can be rather complicated due to external dependencies and such, I provided a debug build of the Cython module in question for Python 3.8 amd64 Windows and will try to attach it to this issue so that you can download and test with it if you like. GitHub doesn't allow attaching whl files however, so I provided a download link. Hope thats okay.
https://web.cubbit.io/link/#7b1e965a-84d0-42ed-b955-bfe35f2dad10!LkZm1MtOAWSvhQrhNb3ZXMUhCA6zVdghjXxDI9aZTBA!8TINwrWKR/KE7IMroFOlhw
As I already mentioned, the issues seem to have started around the time of coverage getting updated to version 5.0. Those of you who are much more familiar with coverage and its history might know what changed during that update and thus be able to track down the issue much faster than me, I literally got into coverage about 2 days ago. Its probably just a matter of asking the right questions, but i'm not experienced enough to do so.
Steps to reproduce the issue:
I hope that I didn't forget anything, the problem kept me busy for quite a few hours now and I tried alot to track it down, just let me know if you need anything.
Thank you.
The text was updated successfully, but these errors were encountered: