Skip to content

Commit 2ce369a

Browse files
committed
Enable Python 3.10's EncodingWarning
This warns on the default encoding being used in ``open`` or ``io.open``, which can lead to cross-platform bugs (for example on Windows where the default codepage is cp1252), or with the upcoming change to the default Python encoding (PEP 686, Make UTF-8 mode default https://peps.python.org/pep-0686/)
1 parent 59b8ec3 commit 2ce369a

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

tox.ini

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@ passenv = USER USERNAME COVERAGE_* PYTEST_ADDOPTS TERM SETUPTOOLS_SCM_PRETEND_VE
3333
setenv =
3434
_PYTEST_TOX_DEFAULT_POSARGS={env:_PYTEST_TOX_POSARGS_DOCTESTING:} {env:_PYTEST_TOX_POSARGS_LSOF:} {env:_PYTEST_TOX_POSARGS_XDIST:}
3535

36+
# Warn where default encoding is used
37+
# https://docs.python.org/3/library/io.html#io-encoding-warning
38+
PYTHONWARNDEFAULTENCODING=1
39+
3640
# Configuration to run with coverage similar to CI, e.g.
3741
# "tox -e py37-coverage".
3842
coverage: _PYTEST_TOX_COVERAGE_RUN=coverage run -m

0 commit comments

Comments
 (0)