Coverage plugin broken with coverage.py 5.x
See original GitHub issueCoverage reporting using the Cython plugin does not work for the 5.x series of coverage.py. For example, attempting to run coverage tests on raysect produces errors:
python setup.py build_ext -j4 --inplace --line-profile
coverage run -m unittest discover
Output:
...................................................................................................................................................................................................................................................................................................................................................................................................................................................
----------------------------------------------------------------------
Ran 435 tests in 2.122s
OK
Can't add file tracer data for unmeasured file '/home/jlovell/FUN/cherab/raysect/raysect/core/math/_vec3.pxd'
Attempting to produce HTML output also results in an error:
coverage html
Output:
Couldn't parse '/home/jlovell/FUN/cherab/raysect/raysect/core/acceleration/accelerator.pyx' as Python source: 'invalid syntax' at line 32
Using coverage.py 4.5 on the same set of build files results in no errors reported about pyx files, and the HTML output is produced successfully.
Issue Analytics
- State:
- Created 3 years ago
- Comments:18 (9 by maintainers)
Top Results From Across the Web
Major changes in 5.0 — Coverage.py 6.5.0 documentation
This is an overview of the changes in 5.0 since the last version of 4.5.x. This is not a complete list of all...
Read more >Contributing to coverage.py - Read the Docs
I welcome contributions to coverage.py. Over the years, dozens of people have provided patches of various sizes to add features or fix bugs....
Read more >Change history for coverage.py - Read the Docs
Change history for coverage.py¶. These changes are listed in decreasing version number order. Note this can be different from a strict chronological order ......
Read more >Coverage.py API — Coverage.py 6.5.0 documentation
Coverage.py supports plugins that can change its behavior, to collect information from non-Python files, or to perform complex configuration. See Plug-in ...
Read more >Release 7.0.0b1 unknown - Coverage.py
For example, pytest has the pytest-cov plugin. You can fine-tune coverage.py's view of your code by directing it to ignore parts that you...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
OK, I took some time to look into this issue from the Cython point of view by getting into Cython.Coverage and think that I got a pretty good feeling about what this plugin does/should do. I started to debug a little further and thats what I found out so far, maybe it will help someone else to track the problem down later. Let’s consider this a progress report on my findings up to this point.
As far as my debugging goes, the file_tracer method of Cython.Coverage.Plugin never returns an actual file tracer object to coverage.py right now, at least not in my specific constellation. Furthermore, it only gets called with .py files from site packages like pytest and such, but never with a single file from the package that I told it to actually measure. I literally don’t know where coverage gets the idea of a .pxd file from, because Cython.Coverage doesn’t seem to get in contact with any of these, or I didn’t find the function yet where this is supposed to happen. I’ll probably see if I can further debug something from the coverage side of things, but the situation as it stands right now leaves me rather clueless. Coverage.py however thinks that .pxd files are associated to Cython.Coverage.Plugin, so that seems to be fine so far.
I’ve merged https://github.com/nedbat/coveragepy/pull/1347, fyi.