Comments (13)
Can you upload the .coverage file or provide details about where it came from? The error suggests the file is not a valid python coverage file.
from vim-coverage.
Sure, here is the file https://drive.google.com/file/d/1SpHT06QoMvtz13NyQkM6UeOGoDSuI25W/view?usp=sharing .
It works fine when I run coverage html
tho.
from vim-coverage.
Looks like i figured it out, previous .coverage file was produced by using --cov-report term
. I updated the args to --cov-report html
and the cov.load() works fine. Thanks!
from vim-coverage.
oh no, it only works in separate python file
(venv) ➜ tinydb git:(master) ✗ python3
Python 3.6.11 (heads/master-dirty:86df475, Jul 31 2020, 00:00:00)
[GCC 9.3.1 20200408 (Red Hat 9.3.1-2)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from coverage import Coverage
>>> cov = Coverage()
>>> cov.load()
>>>
but error still occurs when running ':CoverageShow'
from vim-coverage.
And the same error from :CoverageShow
, or slightly different?
Might also be room to improve that error if we can narrow down a clear failure scenario and how to detect it in our code.
from vim-coverage.
It was the same error. Turns out the error occurs because I forgot to activate virtualenv and I was using the older version of coverage in my os.
$ pip freeze | grep coverage
coverage==4.5.4
It's working fine when I use the newer 5.2.1
version.
can we catch this kind of error and rewrite it to a more informative error ?
from vim-coverage.
Oof, yeah, I'd hope we could detect those kinds of trivial format compatibility issues, but that error from coverage is pretty nonspecific. Do you know if there's any helper to inspect the old format or good heuristic to check for files in the old format?
from vim-coverage.
I've searched for the correct pytest version that produced the older format, but sadly, I couldn't find any. Best I can think of right now is to catch this error UnicodeDecodeError
and rewrite it to something like coverage data is not valid, check your coverage version ....
from vim-coverage.
👍 I imagine providing a little context and trimming out some of the noise from that error would be a major improvement. In this case the one CoverageException line contains the essential info. Ideally the error would look something like
ERROR: ShowCoverage failed to read coverage file: coverage.misc.CoverageException: Couldn't read data from '/home/fedora/Desktop/GIT/tinydb/.coverage': UnicodeDecodeError: 'utf-8' codec can't decode byte 0xf0 in position 99: invalid continuation byte
.
That said, could take me quite some time to get around to submitting a fix. Contributions would be very welcome!
from vim-coverage.
Nice, I'll find some time to work on this one if that's ok
from vim-coverage.
Yes, that would be great!
You can include the coverage version from coverage.__version__
in the error message and just say it expected a coverage file compatible with that, check for mixed installations, and regenerate .coverage if needed. And then try to keep the original error message included in some form in case there's another cause for errors like a bug in the coverage library that the user would need to troubleshoot.
from vim-coverage.
Having the same issue. The traceback tells that plugin tries to read file .coverage
as UTF-8 text, whereas it is actually an SQLite database:
$ file .coverage
.coverage: SQLite 3.x database, last written using SQLite version 3022000
That is the case since coveragepy==5.0a2. The code supporting JSON format has then been removed in coveragepy==5.0a6.
Just tested that reverting to coveragepy==4.5.4
fixes the issue.
from vim-coverage.
Oh, so probably it was the same unsupported SQLite issue all along! That sounds like we could catch and give a much more user-friendly message for this case, when it hits a UnicodeDecodeError
trying to decode a file that's actually SQLite.
from vim-coverage.
Related Issues (17)
- Error showing coverage on modified buffer after :make HOT 3
- List of coverage providers HOT 3
- Add "show if available" variant to be used in autocmds
- :CoverageShowDiff is not implemented?! HOT 5
- Provide diagnostic command for troubleshooting
- Reload coverage information / refresh cache HOT 7
- Support rendering coverage results generated from older versions of a file HOT 2
- Travis test runs failing with "python" command not available
- Mechanism to invoke "bazel coverage" and show the results HOT 1
- Mechanism to watch & dynamically reload coverage results HOT 5
- Implement a Cobertura coverage provider HOT 2
- Add commands & keymappings for jumping to the next uncovered line HOT 1
- Does Python coverage require a Vim with Python support? HOT 1
- Implement gcov coverage provider HOT 3
- Implement ruby rcov coverage provider
- Implement python nose coverage provider HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vim-coverage.