我在 tox 中有以下配置:
[tox]
envlist = py37
[testenv]
passenv = TRAVIS TRAVIS_*
setenv =
DEFAULT_FROM = mock_email@mock.com
DEFAULT_SERVER = mock_server
basepython =
py37: python3.7
deps =
-r{toxinidir}/requirements.txt
-r{toxinidir}/test-requirements.txt
nose
pytest
pytest-cov
sitepackages = False
commands =
pytest {posargs} --cov
# Add the following line locally to get an HTML report --cov-report html:htmlcov-py37
以及以下.coveragerc
文件:
[run]
branch=True
source=sync2jira/
omit=sync2jira/mailer.py
[report]
fail_under=60
但无论如何(即使在 Travis 中)python-coveralls 似乎都无法将数据发送到工作服。我收到以下错误:
Submitting coverage to coveralls.io...
Traceback (most recent call last):
File "/Users/sidpremkumar/Documents/Work/Sync2Jira/venv/lib/python3.7/site-packages/coverage/data.py", line 293, in read_file
self.read_fileobj(f)
File "/Users/sidpremkumar/Documents/Work/Sync2Jira/venv/lib/python3.7/site-packages/coverage/data.py", line 271, in read_fileobj
data = self._read_raw_data(file_obj)
File "/Users/sidpremkumar/Documents/Work/Sync2Jira/venv/lib/python3.7/site-packages/coverage/data.py", line 311, in _read_raw_data
go_away = file_obj.read(len(cls._GO_AWAY))
File "/Users/sidpremkumar/Documents/Work/Sync2Jira/venv/bin/../lib/python3.7/codecs.py", line 322, in decode
(result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x96 in position 106: invalid start byte
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/sidpremkumar/Documents/Work/Sync2Jira/venv/bin/coveralls", line 8, in <module>
sys.exit(main())
File "/Users/sidpremkumar/Documents/Work/Sync2Jira/venv/lib/python3.7/site-packages/coveralls/cli.py", line 77, in main
result = coverallz.wear()
File "/Users/sidpremkumar/Documents/Work/Sync2Jira/venv/lib/python3.7/site-packages/coveralls/api.py", line 176, in wear
json_string = self.create_report()
File "/Users/sidpremkumar/Documents/Work/Sync2Jira/venv/lib/python3.7/site-packages/coveralls/api.py", line 192, in create_report
data = self.create_data()
File "/Users/sidpremkumar/Documents/Work/Sync2Jira/venv/lib/python3.7/site-packages/coveralls/api.py", line 246, in create_data
self._data = {'source_files': self.get_coverage()}
File "/Users/sidpremkumar/Documents/Work/Sync2Jira/venv/lib/python3.7/site-packages/coveralls/api.py", line 261, in get_coverage
workman.load()
File "/Users/sidpremkumar/Documents/Work/Sync2Jira/venv/lib/python3.7/site-packages/coverage/control.py", line 677, in load
self.data_files.read(self.data)
File "/Users/sidpremkumar/Documents/Work/Sync2Jira/venv/lib/python3.7/site-packages/coverage/data.py", line 653, in read
data.read_file(self.filename)
File "/Users/sidpremkumar/Documents/Work/Sync2Jira/venv/lib/python3.7/site-packages/coverage/data.py", line 297, in read_file
filename, exc.__class__.__name__, exc,
coverage.misc.CoverageException: Couldn't read data from '/Users/sidpremkumar/Documents/Work/Sync2Jira/.coverage': UnicodeDecodeError: 'utf-8' codec can't decode byte 0x96 in position 106: invalid start byte
任何想法为什么我会收到此错误?我也尝试coverage
过,pytest
但没有运气。