Fix test failures with Python 3.11.7, 3.12.1 and later

This commit is contained in:
Karolina Surma 2023-12-12 14:11:44 +01:00
parent 3a7f1fc944
commit 70abcdbd9f
2 changed files with 77 additions and 1 deletions

69
11774.patch Normal file
View File

@ -0,0 +1,69 @@
From bc8939b34037f81b8610f3b26caec128ee20a2f4 Mon Sep 17 00:00:00 2001
From: Karolina Surma <ksurma@redhat.com>
Date: Tue, 28 Nov 2023 14:43:58 +0100
Subject: [PATCH] Adjust the expected string to match Python 3.11+ changed
output
---
tests/test_ext_autodoc_configs.py | 21 +++++++++++++++++----
1 file changed, 17 insertions(+), 4 deletions(-)
diff --git a/tests/test_ext_autodoc_configs.py b/tests/test_ext_autodoc_configs.py
index 45bc729b73e..0994c08e899 100644
--- a/tests/test_ext_autodoc_configs.py
+++ b/tests/test_ext_autodoc_configs.py
@@ -11,6 +11,7 @@
from .test_ext_autodoc import do_autodoc
IS_PYPY = platform.python_implementation() == 'PyPy'
+IS_PY311_AND_LATER = sys.version_info >= (3, 11)
@contextmanager
@@ -1627,7 +1628,10 @@ def test_autodoc_default_options(app):
assert ' Iterate squares of each value.' in actual
if not IS_PYPY:
assert ' .. py:attribute:: CustomIter.__weakref__' in actual
- assert ' list of weak references to the object (if defined)' in actual
+ if IS_PY311_AND_LATER:
+ assert ' list of weak references to the object' in actual
+ else:
+ assert ' list of weak references to the object (if defined)' in actual
# :exclude-members: None - has no effect. Unlike :members:,
# :special-members:, etc. where None == "include all", here None means
@@ -1651,7 +1655,10 @@ def test_autodoc_default_options(app):
assert ' Iterate squares of each value.' in actual
if not IS_PYPY:
assert ' .. py:attribute:: CustomIter.__weakref__' in actual
- assert ' list of weak references to the object (if defined)' in actual
+ if IS_PY311_AND_LATER:
+ assert ' list of weak references to the object' in actual
+ else:
+ assert ' list of weak references to the object (if defined)' in actual
assert ' .. py:method:: CustomIter.snafucate()' in actual
assert ' Makes this snafucated.' in actual
@@ -1698,7 +1705,10 @@ def test_autodoc_default_options_with_values(app):
assert ' Iterate squares of each value.' in actual
if not IS_PYPY:
assert ' .. py:attribute:: CustomIter.__weakref__' not in actual
- assert ' list of weak references to the object (if defined)' not in actual
+ if IS_PY311_AND_LATER:
+ assert ' list of weak references to the object' not in actual
+ else:
+ assert ' list of weak references to the object (if defined)' not in actual
# with :exclude-members:
app.config.autodoc_default_options = {
@@ -1722,6 +1732,9 @@ def test_autodoc_default_options_with_values(app):
assert ' Iterate squares of each value.' in actual
if not IS_PYPY:
assert ' .. py:attribute:: CustomIter.__weakref__' not in actual
- assert ' list of weak references to the object (if defined)' not in actual
+ if IS_PY311_AND_LATER:
+ assert ' list of weak references to the object' not in actual
+ else:
+ assert ' list of weak references to the object (if defined)' not in actual
assert ' .. py:method:: CustomIter.snafucate()' not in actual
assert ' Makes this snafucated.' not in actual

View File

@ -25,7 +25,7 @@ Name: python-sphinx
#global prerel ...
%global upstream_version %{general_version}%{?prerel}
Version: %{general_version}%{?prerel:~%{prerel}}
Release: 3%{?dist}
Release: 4%{?dist}
Epoch: 1
Summary: Python documentation generator
@ -55,6 +55,10 @@ Patch: sphinx-test_theming.diff
# The change is proposed upstream.
Patch: https://github.com/sphinx-doc/sphinx/pull/11747.patch
# Fix the expected test docstring to match output in Python 3.11.7, 3.12.1 and later
# Proposed upstream.
Patch: https://github.com/sphinx-doc/sphinx/pull/11774.patch
BuildArch: noarch
BuildRequires: make
@ -398,6 +402,9 @@ mkdir %{buildroot}%{python3_sitelib}/sphinxcontrib
%changelog
* Tue Dec 12 2023 Karolina Surma <ksurma@redhat.com> - 1:7.2.6-4
- Fix the tests run when building with Python 3.11.7, 3.12.1 and later
* Thu Nov 16 2023 Miro Hrončok <mhroncok@redhat.com> - 1:7.2.6-3
- On Fedora, BuildRequire the sphinxcontrib packages to build the documentation