Fix autodoc tests for Python 3.11+ #11793
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Feature or Bugfix
Purpose
Detail
Since Python 3.11.7, 3.12.0 and 3.13.0a2, "list of weak references to the object (if defined)" was changed to "list of weak references to the object".
Add a version check to decide text to assert.
Before: https://github.com/sphinx-doc/sphinx/actions/runs/7158385030?pr=11791
After: https://github.com/sphinx-doc/sphinx/actions/runs/7166386276?pr=11793
("Docutils HEAD" fails because https://repo.or.cz/docutils.git/ is 403 -- see PR #11794 -- and Windows fails with
test_gettext_dont_rebuild_mo
.)Also in Ruff v0.1.0:
So use that option for "Lint with latest Ruff" to prevent
error: unexpected argument '--format' found
.https://github.com/astral-sh/ruff/releases/tag/v0.1.0
Relates
(if defined)
part from__dict__
and__weakref__
docstrings python/cpython#112268