-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Closed
Labels
good first issueeasy issue that is friendly to new contributoreasy issue that is friendly to new contributorplugin: cacherelated to the cache builtin pluginrelated to the cache builtin plugin
Description
Sphinx recently enabled the EncodingWarning
feature of Python 3.10+ in tests.12
PyTest reports three EncodingWarning
s 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
Footnotes
Metadata
Metadata
Assignees
Labels
good first issueeasy issue that is friendly to new contributoreasy issue that is friendly to new contributorplugin: cacherelated to the cache builtin pluginrelated to the cache builtin plugin