From 70abcdbd9fa660d5c2571e3faad6b0248f6d6c35 Mon Sep 17 00:00:00 2001 From: Karolina Surma Date: Tue, 12 Dec 2023 14:11:44 +0100 Subject: [PATCH] Fix test failures with Python 3.11.7, 3.12.1 and later --- 11774.patch | 69 ++++++++++++++++++++++++++++++++++++++++++++++ python-sphinx.spec | 9 +++++- 2 files changed, 77 insertions(+), 1 deletion(-) create mode 100644 11774.patch diff --git a/11774.patch b/11774.patch new file mode 100644 index 0000000..47370b2 --- /dev/null +++ b/11774.patch @@ -0,0 +1,69 @@ +From bc8939b34037f81b8610f3b26caec128ee20a2f4 Mon Sep 17 00:00:00 2001 +From: Karolina Surma +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 diff --git a/python-sphinx.spec b/python-sphinx.spec index 6bba4f7..6b74c11 100644 --- a/python-sphinx.spec +++ b/python-sphinx.spec @@ -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 - 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 - 1:7.2.6-3 - On Fedora, BuildRequire the sphinxcontrib packages to build the documentation