Sphinx recently enabled the EncodingWarning feature of Python 3.10+ in tests.12
PyTest reports three EncodingWarnings in _pytest/cacheprovider.py, output below:
.tox/du18/lib/python3.10/site-packages/_pytest/cacheprovider.py:199
/home/runner/work/sphinx/sphinx/.tox/du18/lib/python3.10/site-packages/_pytest/cacheprovider.py:199: EncodingWarning: 'encoding' argument not specified
readme_path.write_text(README_CONTENT)
.tox/du18/lib/python3.10/site-packages/_pytest/cacheprovider.py:189
.tox/du18/lib/python3.10/site-packages/_pytest/cacheprovider.py:189
/home/runner/work/sphinx/sphinx/.tox/du18/lib/python3.10/site-packages/_pytest/cacheprovider.py:189: EncodingWarning: 'encoding' argument not specified
f = path.open("w")
.tox/du18/lib/python3.10/site-packages/_pytest/cacheprovider.py:160
/home/runner/work/sphinx/sphinx/.tox/du18/lib/python3.10/site-packages/_pytest/cacheprovider.py:160: EncodingWarning: 'encoding' argument not specified
with path.open("r") as f:
The remedy is to add an explicit encoding="..." argument, most likely "utf-8".
Reproducer is python -X warn_default_encoding -m pytest ... with a path to a test suite.
Test session preamble:
============================= test session starts ==============================
platform linux -- Python 3.10.4, pytest-7.1.2, pluggy-1.0.0 -- /home/runner/work/sphinx/sphinx/.tox/du18/bin/python
cachedir: .tox/du18/.pytest_cache
libraries: Sphinx-5.0.0+/7970e6c, docutils-0.18.1
base tempdir: /tmp/pytest-of-runner/pytest-0
rootdir: /home/runner/work/sphinx/sphinx, configfile: setup.cfg, testpaths: tests
plugins: cov-3.0.0
A
Sphinx recently enabled the
EncodingWarningfeature of Python 3.10+ in tests.12PyTest reports three
EncodingWarnings in_pytest/cacheprovider.py, output below:The remedy is to add an explicit
encoding="..."argument, most likely"utf-8".Reproducer is
python -X warn_default_encoding -m pytest ...with a path to a test suite.Test session preamble:
A
Footnotes
https://docs.python.org/3/library/io.html#io-encoding-warning ↩
https://docs.python.org/3/using/cmdline.html?highlight=warn_default_encoding#cmdoption-X ↩