Repository navigation
Fix/silence doctest warnings #94001
Description
Activity
- addedtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or errortestsTests in the Lib/test dirTests in the Lib/test dir3.11only security fixesonly security fixes3.10 (EOL)end of lifeend of life3.12only security fixesonly security fixes
on Jun 19, 2022 The stdlib's tests use the
_ignore_deprecated_importscontext manager; if a doctest example is for the deprecated module itself, that could be used in a hidden block, if it involves another module using the deprecated module, the example/doctest should be updated to use a replacement (or removed, if not possible).It seems several warnings are for third party projects (Sphinx, etc) using stdlib modules that are deprecated; in that case, those projects should be updated.
In 3.10, the warnings look to be due to Sphinx 3.x using names deprecated in Jinja 3.x. Either it should be upgrade to use Sphinx 4, or jinja should be upper capped at
<3.Reacted by Serhiy StorchakaIt seems several warnings are for third party projects (Sphinx, etc) using stdlib modules that are deprecated; in that case, those projects should be updated.
Third-party deprecation warnings in
mainand 3.11:/home/runner/work/cpython/cpython/Doc/venv/lib/python3.12/site-packages/babel/messages/catalog.py:13: DeprecationWarning: 'cgi' is deprecated and slated for removal in Python 3.13
Fixed in python-babel/babel#876, pending release.
Edit: ✅ Released in Babel 2.11.0!
/home/runner/work/cpython/cpython/Doc/venv/lib/python3.12/site-packages/sphinx/util/images.py:4: DeprecationWarning: 'imghdr' is deprecated and slated for removal in Python 3.13
Pending issue: sphinx-doc/sphinx#10440
Edit: ✅ Released in Sphinx 6.2.0!
/home/runner/work/cpython/cpython/Doc/venv/lib/python3.12/site-packages/certifi/core.py:36: DeprecationWarning: path is deprecated. Use files() instead. Refer to https://importlib-resources.readthedocs.io/en/latest/using.html#migrating-from-legacy for migration advice.
PR pending merge: certifi/python-certifi#193
Edit: ✅ Merged via certifi/python-certifi#199 and released in Certifi 2022.06.15.1!
Reacted by Ezio Melotti and C.A.M. GerlachCurrent status (from https://github.com/python/cpython/actions/runs/5075730602/jobs/9117235935):
Run xvfb-run make -C Doc/ PYTHON=../python SPHINXERRORHANDLING="-W --keep-going" doctest make: Entering directory '/home/runner/work/cpython/cpython/Doc' make[1]: Entering directory '/home/runner/work/cpython/cpython/Doc' mkdir -p build Building NEWS from Misc/NEWS.d with blurb PATH=./venv/bin:$PATH sphinx-build -b doctest -d build/doctrees -j auto -W --keep-going . build/doctest Running Sphinx v[4](https://github.com/python/cpython/actions/runs/5075730602/jobs/9117235935#step:9:5).[5](https://github.com/python/cpython/actions/runs/5075730602/jobs/9117235935#step:9:6).0 /home/runner/work/cpython/cpython/Doc/venv/lib/python3.13/site-packages/sphinx/util/images.py:4: DeprecationWarning: 'imghdr' is deprecated and slated for removal in Python 3.13 import imghdr /home/runner/work/cpython/cpython/Doc/venv/lib/python3.13/site-packages/sphinx/builders/gettext.py:1[6](https://github.com/python/cpython/actions/runs/5075730602/jobs/9117235935#step:9:7)4: DeprecationWarning: datetime.utcfromtimestamp() is deprecated and scheduled for removal in a future version. Use timezone-aware objects to represent datetimes in UTC: datetime.fromtimestamp(timestamp, datetime.UTC). datetime.utcfromtimestamp(timestamp)imghdrdeprecation is addressed by gh-104818However, I cannot find if
datetime.utcfromtimestampdeprecation is addressed so I cannot close this issue since the originally reported warnings are fixed.- addedpendingThe issue will be closed if no feedback is providedThe issue will be closed if no feedback is provided
on May 25, 2023 However, I cannot find if
datetime.utcfromtimestampdeprecation is addressed so I cannot close this issue since the originally reported warnings are fixed.The warning is new in 3.12 and first needs fixing in Sphinx:
Would you like to open an issue over there? cc @AA-Turner
Reacted by Oleg IaryginWould you like to open an issue over there?
I'll do it later this day if nobody else gets ahead of me.
Btw, https://docs.python.org/3/library/datetime.html#datetime.datetime.utcfromtimestamp seems to not have the deprecation note.
Reacted by Hugo van KemenadeYep, the deprecation is new in 3.12, and shown here:
- https://docs.python.org/3.12/library/datetime.html#datetime.datetime.utcfromtimestamp
- https://docs.python.org/3.12/library/datetime.html#datetime.datetime.utcnow
- https://docs.python.org/3.12/whatsnew/3.12.html#deprecated
The issue: #103857
- added3.13only security fixesonly security fixesand removed3.10 (EOL)end of lifeend of life
on Oct 6, 2023 These have all been fixed (pending updating the Sphinx version).
A
Reacted by Hugo van Kemenade
I noticed a few warnings triggered during the
Doctest workflows. These should be either fixed by updating/removing the examples, or possibly silenced.These are the (collapsed) outputs on
main/3.11/3.10:main
From https://github.com/python/cpython/runs/6946479177?check_suite_focus=true
3.11
From https://github.com/python/cpython/runs/6954035375?check_suite_focus=true
3.10
From https://github.com/python/cpython/runs/6954044919?check_suite_focus=true