z4r / python-coveralls

Python API for http://coveralls.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Breaks with coverage 5.0

skwashd opened this issue · comments

The 5.0 release of the coverage package contains backwards compatibility breaking changes. One of those changes was removing the Reporter class. This results in the following output in Travis CI:

$ coveralls
Traceback (most recent call last):
  File "/home/travis/virtualenv/python3.7.1/bin/coveralls", line 10, in <module>
    sys.exit(wear())
  File "/home/travis/virtualenv/python3.7.1/lib/python3.7/site-packages/coveralls/__init__.py", line 78, in wear
    from coveralls.control import coveralls
  File "/home/travis/virtualenv/python3.7.1/lib/python3.7/site-packages/coveralls/control.py", line 2, in <module>
    from coveralls.report import CoverallsReporter
  File "/home/travis/virtualenv/python3.7.1/lib/python3.7/site-packages/coveralls/report.py", line 6, in <module>
    from coverage.report import Reporter
ImportError: cannot import name 'Reporter' from 'coverage.report' (/home/travis/virtualenv/python3.7.1/lib/python3.7/site-packages/coverage/report.py)

For info, I have this issue too with Frappe apps (frappe/frappe#9169), but after pinning coverage version to 4.5.4 I have a new error :

UnicodeDecodeError: 'utf-8' codec can't decode byte 0x96 in position 106: invalid start byte

The source code analyzed has not changed and, of course, I did not had this error before.
I saw #31 and #30 but the solution does not apply in my case. Maybe it's not related, but has anyone encountered this and found a solution ?

Any news on supporting coverage>=5?

@hartwork unless there is something you specifically need here, this worked for me:
https://github.com/coveralls-clients/coveralls-python

If you are having a trouble with Travis CI, have a look at #74.

@madmath03 That error is due to the outputted .coverage file format is different for coverage 5.0+. The fix is to downgrade coverage and re-run your test suite, which will regenerate that file in the older format that can be read by the coveralls command.

Commenting here since this thread shows up in Google searches often.

There's no need to pin to an older version of coveralls.
Instead, make sure you are not installing coverage or python-coveralls as they seem to cause some sort of conflict (See: #73).

This combination is working for me:

pip install -U pytest pytest-cov coveralls

@amykyta3 I tried this as I had the same issue but it didn't solve it.

I use coverage for coverage report -m, and I use coveralls for coveralls. Are you saying that it's no big deal that they are incompatible? I suppose I could carefully use only one or the other depending on the circumstances. Normally the tools I use aren't this finicky.

I downgraded coverage to a version < 5 and it solved this issue.

Yes, see the title of the bug and numerous comments above: the problem starts with coverage version 5.

Looking at setup.py for this package, it imports "coverage" without any version.