Skip to content

Fix/silence doctest warnings #94001

@ezio-melotti

Description

@ezio-melotti

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

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 -q -W --keep-going . build/doctest /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 from cgi import parse_header /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 import imghdr /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. _CACERT_CTX = get_path("certifi", "cacert.pem") <doctest default[0]>:1: DeprecationWarning: 'nntplib' is deprecated and slated for removal in Python 3.13 from nntplib import NNTP /home/runner/work/cpython/cpython/Lib/socket.py:777: ResourceWarning: unclosed <socket.socket fd=4, family=2, type=1, proto=6, laddr=('10.1.0.37', 45010), raddr=('116.202.254.214', 119)> self._sock = None ResourceWarning: Enable tracemalloc to get the object allocation traceback <doctest default[0]>:1: DeprecationWarning: the imp module is deprecated in favour of importlib and slated for removal in Python 3.12; see the module's documentation for alternative uses import imp <doctest default[3]>:1: DeprecationWarning: 'turtle.RawTurtle.settiltangle()' is deprecated since Python 3.1 and scheduled for removal in Python 3.13. Use tiltangle() instead. turtle.settiltangle(45)
3.11

From https://github.com/python/cpython/runs/6954035375?check_suite_focus=true

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 -q -W --keep-going . build/doctest /home/runner/work/cpython/cpython/Doc/venv/lib/python3.11/site-packages/babel/messages/catalog.py:13: DeprecationWarning: 'cgi' is deprecated and slated for removal in Python 3.13 from cgi import parse_header /home/runner/work/cpython/cpython/Doc/venv/lib/python3.11/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.11/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. _CACERT_CTX = get_path("certifi", "cacert.pem") <doctest default[0]>:1: DeprecationWarning: 'nntplib' is deprecated and slated for removal in Python 3.13 from nntplib import NNTP /home/runner/work/cpython/cpython/Lib/socket.py:776: ResourceWarning: unclosed <socket.socket fd=4, family=2, type=1, proto=6, laddr=('10.1.0.43', 48872), raddr=('116.202.254.214', 119)> self._sock = None ResourceWarning: Enable tracemalloc to get the object allocation traceback <doctest default[3]>:1: DeprecationWarning: 'turtle.RawTurtle.settiltangle()' is deprecated since Python 3.1 and scheduled for removal in Python 3.13. Use tiltangle() instead. turtle.settiltangle(45) <doctest default[0]>:1: DeprecationWarning: the imp module is deprecated in favour of importlib and slated for removal in Python 3.12; see the module's documentation for alternative uses import imp
3.10

From https://github.com/python/cpython/runs/6954044919?check_suite_focus=true

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 -q -W --keep-going . build/doctest /home/runner/work/cpython/cpython/Doc/venv/lib/python3.10/site-packages/sphinx/util/docutils.py:45: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead. __version_info__ = tuple(LooseVersion(docutils.__version__).version) /home/runner/work/cpython/cpython/Doc/venv/lib/python3.10/site-packages/sphinx/util/rst.py:56: DeprecationWarning: 'environmentfilter' is renamed to 'pass_environment', the old name will be removed in Jinja 3.1. def heading(env: Environment, text: str, level: int = 1) -> str: /home/runner/work/cpython/cpython/Doc/venv/lib/python3.10/site-packages/sphinx/jinja2glue.py:106: DeprecationWarning: 'contextfunction' is renamed to 'pass_context', the old name will be removed in Jinja 3.1. def warning(context: Dict, message: str, *args: Any, **kwargs: Any) -> str: <doctest default[0]>:1: DeprecationWarning: the imp module is deprecated in favour of importlib and slated for removal in Python 3.12; see the module's documentation for alternative uses import imp /home/runner/work/cpython/cpython/Lib/socket.py:776: ResourceWarning: unclosed <socket.socket fd=4, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=6, laddr=('10.1.1.51', 47304), raddr=('116.202.254.214', 119)> self._sock = None ResourceWarning: Enable tracemalloc to get the object allocation traceback <doctest default[2]>:1: DeprecationWarning: `formatargspec` is deprecated since Python 3.5. Use `signature` and the `Signature` object directly formatargspec(*getfullargspec(f))

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.11only security fixes3.12only security fixes3.13bugs and security fixespendingThe issue will be closed if no feedback is providedtestsTests in the Lib/test dirtype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions