Analysis fail on unicode characters on pyproject.toml ON WINDOWS only · Issue #990 · nedbat/coveragepy (original) (raw)
Describe the bug
If you add coverage with toml extra and have unicode characters on your pyproject.toml you get enconding error on coverage analysis on Windows only.
To Reproduce
How can we reproduce the problem?
- What version of Python are you using? 3.8.2
- What version of coverage.py are you using?
# coverage debug sys
-- sys -------------------------------------------------------
version: 5.1
coverage: /home/static/.cache/pypoetry/virtualenvs/toml-validator-zr_HNKMd-py3.8/lib/python3.8/site-packages/coverage/__init__.py
tracer: -none-
CTracer: available
plugins.file_tracers: -none-
plugins.configurers: -none-
plugins.context_switchers: -none-
configs_attempted: .coveragerc
setup.cfg
tox.ini
pyproject.toml
configs_read: /home/static/workspace/toml-validator/pyproject.toml
config_file: /home/static/workspace/toml-validator/pyproject.toml
config_contents: '[tool.poetry]\nname = "toml-validator"\nversion = "1.3.1"\ndescription = "Simple TOML file validator using Python."\nauthors = ["Thiago Carvalho D\'Ávila <thiagocavila@gmail.com>"]\nlicense = "MIT"\nreadme = "README.md"\nrepository = "https://github.com/staticdev/toml-validator"\nhomepage = "https://github.com/staticdev/toml-validator"\n\n[tool.poetry.dependencies]\npython = "^3.7"\ntomlkit = ">=0.5.9,<0.7.0"\nclick = "^7.0"\nimportlib_metadata = {version = "^1.6.0", python = "<3.8"}\n\n[tool.poetry.dev-dependencies]\npytest = "^5.4.2"\ncoverage = {extras = ["toml"], version = "^5.0.3"}\nblack = "^19.10b0"\nflake8 = "^3.8.1"\nflake8-bandit = "^2.1.2"\nflake8-black = "^0.2.0"\nflake8-bugbear = "^20.1.4"\nsafety = "^1.8.5"\nmypy = "^0.770"\ncodecov = "^2.1.1"\npytest-mock = "^3.0.0"\ntypeguard = "^2.7.1"\npre-commit = "^2.4.0"\n\n[tool.poetry.scripts]\ntoml-validator = "toml_validator.__main__:main"\n\n[tool.coverage.paths]\nsource = ["src", "*/site-packages"] # configure source tree layout\n\n[tool.coverage.run]\nbranch = true # enable branch analysis\nsource = ["toml_validator"] # configure package name\n\n[tool.coverage.report]\nshow_missing = true\nfail_under = 100\n\n[build-system]\nrequires = ["poetry>=0.12"]\nbuild-backend = "poetry.masonry.api"\n'
data_file: -none-
python: 3.8.2 (default, Apr 5 2020, 18:58:01) [GCC 9.2.1 20191008]
platform: Linux-5.4.0-31-generic-x86_64-with-glibc2.29
implementation: CPython
executable: /home/static/.cache/pypoetry/virtualenvs/toml-validator-zr_HNKMd-py3.8/bin/python
def_encoding: utf-8
fs_encoding: utf-8
pid: 6371
cwd: /home/static/workspace/toml-validator
path: /home/static/.cache/pypoetry/virtualenvs/toml-validator-zr_HNKMd-py3.8/bin
/home/static/.pyenv/versions/3.8.2/lib/python38.zip
/home/static/.pyenv/versions/3.8.2/lib/python3.8
/home/static/.pyenv/versions/3.8.2/lib/python3.8/lib-dynload
/home/static/.cache/pypoetry/virtualenvs/toml-validator-zr_HNKMd-py3.8/lib/python3.8/site-packages
/home/static/workspace/toml-validator/src
environment: PYENV_DIR = /home/static/.poetry/bin
PYENV_HOOK_PATH = /home/static/.pyenv/pyenv.d:/usr/local/etc/pyenv.d:/etc/pyenv.d:/usr/lib/pyenv/hooks:/home/static/.pyenv/plugins/pyenv-virtualenv/etc/pyenv.d:/home/static/.pyenv/plugins/pyenv-which-ext/etc/pyenv.d
PYENV_ROOT = /home/static/.pyenv
PYENV_SHELL = bash
PYENV_VERSION = 3.8.2:3.7.6
PYENV_VIRTUALENV_INIT = 1
command_line: /home/static/.cache/pypoetry/virtualenvs/toml-validator-zr_HNKMd-py3.8/bin/coverage debug sys
sqlite3_version: 2.6.0
sqlite3_sqlite_version: 3.31.1
sqlite3_temp_store: 0
sqlite3_compile_options: COMPILER=gcc-9.3.0
ENABLE_COLUMN_METADATA
ENABLE_DBSTAT_VTAB
ENABLE_FTS3
ENABLE_FTS3_PARENTHESIS
ENABLE_FTS3_TOKENIZER
ENABLE_FTS4
ENABLE_FTS5
ENABLE_JSON1
ENABLE_LOAD_EXTENSION
ENABLE_PREUPDATE_HOOK
ENABLE_RTREE
ENABLE_SESSION
ENABLE_STMTVTAB
ENABLE_UNLOCK_NOTIFY
ENABLE_UPDATE_DELETE_LIMIT
HAVE_ISNAN
LIKE_DOESNT_MATCH_BLOBS
MAX_SCHEMA_RETRY=25
MAX_VARIABLE_NUMBER=250000
OMIT_LOOKASIDE
SECURE_DELETE
SOUNDEX
TEMP_STORE=1
THREADSAFE=1
USE_URI
- What versions of what packages do you have installed?
# pip freeze
appdirs==1.4.4
attrs==19.3.0
bandit==1.6.2
black==19.10b0
certifi==2020.4.5.1
cfgv==3.1.0
chardet==3.0.4
click==7.1.2
codecov==2.1.1
coverage==5.1
distlib==0.3.0
dparse==0.5.1
entrypoints==0.3
filelock==3.0.12
flake8==3.8.1
flake8-bandit==2.1.2
flake8-black==0.2.0
flake8-bugbear==20.1.4
flake8-polyfill==1.0.2
gitdb==4.0.5
GitPython==3.1.2
identify==1.4.15
idna==2.9
mccabe==0.6.1
more-itertools==8.3.0
mypy==0.770
mypy-extensions==0.4.3
nodeenv==1.3.5
packaging==20.4
pathspec==0.8.0
pbr==5.4.5
pipenv==2018.11.26
pluggy==0.13.1
pre-commit==2.4.0
py==1.8.1
pycodestyle==2.6.0
pyflakes==2.2.0
pyparsing==2.4.7
pytest==5.4.2
pytest-mock==3.1.0
PyYAML==5.3.1
regex==2020.5.14
requests==2.23.0
safety==1.9.0
six==1.14.0
smmap==3.0.4
stevedore==1.32.0
toml==0.10.1
-e git+https://github.com/staticdev/toml-validator.git@85ed311bc393956045316d7857470956d3e338ed#egg=toml_validator
tomlkit==0.6.0
typed-ast==1.4.1
typeguard==2.7.1
typing-extensions==3.7.4.2
urllib3==1.25.9
virtualenv==20.0.21
virtualenv-clone==0.5.4
wcwidth==0.1.9
- What code are you running?
See Github actions output from this pull request: Windows staticdev/toml-validator#51 - What commands did you run?
coverage run --parallel -m pytest
Please note that if you change the author name that has the character Á in Ávila from pyproject.toml, the error goes away!
Expected behavior
No error at all.
Additional context
Another package that had exactly the same issue has the following fix: https://github.com/pre-commit/pre-commit-hooks/pull/479/files