Compare commits

...

4 Commits
f41 ... f42

Author SHA1 Message Date
Fedora Release Engineering
cca8be3e8b Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild 2025-01-18 19:29:57 +00:00
Tomáš Hrnčiar
c97bb0f3e2 Update to 8.1.3
- Fixes: rhbz#2275375
2025-01-09 08:31:43 +01:00
Karolina Surma
383e230ab0 Tests sphinx extensions with the package
Tested extensions:
- python-sphinx-theme-alabaster
- python-sphinx_rtd_theme
- python-sphinxcontrib-jquery

The tested extensions are the one that we pull to CentOS Stream/RHEL.
2024-09-20 17:20:44 +02:00
Karolina Surma
f1121b8bac Add a smoke test 2024-08-22 11:29:18 +02:00
17 changed files with 155 additions and 237 deletions

1
.fmf/version Normal file
View File

@@ -0,0 +1 @@
1

1
.gitignore vendored
View File

@@ -47,3 +47,4 @@
/sphinx-7.1.2.tar.gz
/sphinx-7.2.6.tar.gz
/sphinx-7.3.7.tar.gz
/sphinx-8.1.3.tar.gz

View File

@@ -1,37 +0,0 @@
From 12f63b3a0425841f2bdcda3f08e656453ea59297 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org>
Date: Wed, 8 May 2024 14:38:35 +0200
Subject: [PATCH] Move `defusedxml` import into the function using it
Import `defusedxml` inside the `etree_parse()` function rather than
in global scope of `sphinx.testing.util`. This makes it possible
for reverse dependencies (such as `breathe`) to use this module without
adding an unnecessary transitive dependency on `defusedxml` when it's
not actually used.
See also issue #12339.
---
sphinx/testing/util.py | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/sphinx/testing/util.py b/sphinx/testing/util.py
index d1de8ea2b74..b2df709eea8 100644
--- a/sphinx/testing/util.py
+++ b/sphinx/testing/util.py
@@ -11,7 +11,6 @@
from types import MappingProxyType
from typing import TYPE_CHECKING
-from defusedxml.ElementTree import parse as xml_parse
from docutils import nodes
from docutils.parsers.rst import directives, roles
@@ -73,6 +72,8 @@ def assert_node(node: Node, cls: Any = None, xpath: str = "", **kwargs: Any) ->
# keep this to restrict the API usage and to have a correct return type
def etree_parse(path: str | os.PathLike[str]) -> ElementTree:
"""Parse a file into a (safe) XML element tree."""
+ from defusedxml.ElementTree import parse as xml_parse
+
return xml_parse(path)

View File

@@ -1,145 +0,0 @@
From 14da0bb6073a1ec60432340035d17948b3adb22a Mon Sep 17 00:00:00 2001
From: Chris Sewell <chrisj_sewell@hotmail.com>
Date: Wed, 15 May 2024 06:20:54 +0200
Subject: [PATCH] =?UTF-8?q?=F0=9F=A7=AA=20Fix=20python=203.13=20tests?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
tests/test_extensions/test_ext_autodoc.py | 2 +-
.../test_ext_autodoc_configs.py | 31 +++++++++++++------
2 files changed, 22 insertions(+), 11 deletions(-)
diff --git a/tests/test_extensions/test_ext_autodoc.py b/tests/test_extensions/test_ext_autodoc.py
index a88d111bdb3..5a2e91cb5e9 100644
--- a/tests/test_extensions/test_ext_autodoc.py
+++ b/tests/test_extensions/test_ext_autodoc.py
@@ -838,7 +838,7 @@ def test_autodoc_special_members(app):
"special-members": None,
}
if sys.version_info >= (3, 13, 0, 'alpha', 5):
- options["exclude-members"] = "__static_attributes__"
+ options["exclude-members"] = "__static_attributes__,__firstlineno__"
actual = do_autodoc(app, 'class', 'target.Class', options)
assert list(filter(lambda l: '::' in l, actual)) == [
'.. py:class:: Class(arg)',
diff --git a/tests/test_extensions/test_ext_autodoc_configs.py b/tests/test_extensions/test_ext_autodoc_configs.py
index 6c2af5a0652..1262b15162b 100644
--- a/tests/test_extensions/test_ext_autodoc_configs.py
+++ b/tests/test_extensions/test_ext_autodoc_configs.py
@@ -679,6 +679,10 @@ def test_autodoc_typehints_signature(app):
type_o = "~typing.Any | None"
else:
type_o = "~typing.Any"
+ if sys.version_info[:2] >= (3, 13):
+ type_ppp = "pathlib._local.PurePosixPath"
+ else:
+ type_ppp = "pathlib.PurePosixPath"
options = {"members": None,
"undoc-members": None}
@@ -703,7 +707,7 @@ def test_autodoc_typehints_signature(app):
'',
'.. py:data:: CONST3',
' :module: target.typehints',
- ' :type: ~pathlib.PurePosixPath',
+ f' :type: ~{type_ppp}',
" :value: PurePosixPath('/a/b/c')",
'',
' docstring',
@@ -726,7 +730,7 @@ def test_autodoc_typehints_signature(app):
'',
' .. py:attribute:: Math.CONST3',
' :module: target.typehints',
- ' :type: ~pathlib.PurePosixPath',
+ f' :type: ~{type_ppp}',
" :value: PurePosixPath('/a/b/c')",
'',
'',
@@ -748,7 +752,7 @@ def test_autodoc_typehints_signature(app):
'',
' .. py:property:: Math.path',
' :module: target.typehints',
- ' :type: ~pathlib.PurePosixPath',
+ f' :type: ~{type_ppp}',
'',
'',
' .. py:property:: Math.prop',
@@ -773,7 +777,7 @@ def test_autodoc_typehints_signature(app):
'',
' docstring',
'',
- " alias of TypeVar('T', bound=\\ :py:class:`~pathlib.PurePosixPath`)",
+ f" alias of TypeVar('T', bound=\\ :py:class:`~{type_ppp}`)",
'',
'',
'.. py:function:: complex_func(arg1: str, arg2: List[int], arg3: Tuple[int, '
@@ -802,6 +806,10 @@ def test_autodoc_typehints_signature(app):
@pytest.mark.sphinx('html', testroot='ext-autodoc',
confoverrides={'autodoc_typehints': "none"})
def test_autodoc_typehints_none(app):
+ if sys.version_info[:2] >= (3, 13):
+ type_ppp = "pathlib._local.PurePosixPath"
+ else:
+ type_ppp = "pathlib.PurePosixPath"
options = {"members": None,
"undoc-members": None}
actual = do_autodoc(app, 'module', 'target.typehints', options)
@@ -887,7 +895,7 @@ def test_autodoc_typehints_none(app):
'',
' docstring',
'',
- " alias of TypeVar('T', bound=\\ :py:class:`~pathlib.PurePosixPath`)",
+ f" alias of TypeVar('T', bound=\\ :py:class:`~{type_ppp}`)",
'',
'',
'.. py:function:: complex_func(arg1, arg2, arg3=None, *args, **kwargs)',
@@ -1417,7 +1425,10 @@ def test_autodoc_typehints_format_fully_qualified(app):
type_o = "typing.Any | None"
else:
type_o = "typing.Any"
-
+ if sys.version_info[:2] >= (3, 13):
+ type_ppp = "pathlib._local.PurePosixPath"
+ else:
+ type_ppp = "pathlib.PurePosixPath"
options = {"members": None,
"undoc-members": None}
actual = do_autodoc(app, 'module', 'target.typehints', options)
@@ -1441,7 +1452,7 @@ def test_autodoc_typehints_format_fully_qualified(app):
'',
'.. py:data:: CONST3',
' :module: target.typehints',
- ' :type: pathlib.PurePosixPath',
+ f' :type: {type_ppp}',
" :value: PurePosixPath('/a/b/c')",
'',
' docstring',
@@ -1464,7 +1475,7 @@ def test_autodoc_typehints_format_fully_qualified(app):
'',
' .. py:attribute:: Math.CONST3',
' :module: target.typehints',
- ' :type: pathlib.PurePosixPath',
+ f' :type: {type_ppp}',
" :value: PurePosixPath('/a/b/c')",
'',
'',
@@ -1486,7 +1497,7 @@ def test_autodoc_typehints_format_fully_qualified(app):
'',
' .. py:property:: Math.path',
' :module: target.typehints',
- ' :type: pathlib.PurePosixPath',
+ f' :type: {type_ppp}',
'',
'',
' .. py:property:: Math.prop',
@@ -1511,7 +1522,7 @@ def test_autodoc_typehints_format_fully_qualified(app):
'',
' docstring',
'',
- " alias of TypeVar('T', bound=\\ :py:class:`pathlib.PurePosixPath`)",
+ f" alias of TypeVar('T', bound=\\ :py:class:`{type_ppp}`)",
'',
'',
'.. py:function:: complex_func(arg1: str, arg2: List[int], arg3: Tuple[int, '

View File

@@ -1,10 +1,12 @@
From b74128966fe4edf77a0c3a7936f6a6216833c9ed Mon Sep 17 00:00:00 2001
From: Karolina Surma <ksurma@redhat.com>
Date: Thu, 25 Apr 2024 15:58:03 +0200
From 14adc6187c936738cb946c24c4a0820223d65066 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Hrn=C4=8Diar?= <thrnciar@redhat.com>
Date: Wed, 13 Nov 2024 12:25:10 +0100
Subject: [PATCH] Make the first party extensions optional, add [extensions]
extra
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Co-authored-by: Karolina Surma <ksurma@redhat.com>
Co-authored-by: Miro Hrončok <miro@hroncok.cz>
---
pyproject.toml | 33 ++++++++++++++++----
@@ -16,43 +18,43 @@ Co-authored-by: Miro Hrončok <miro@hroncok.cz>
6 files changed, 48 insertions(+), 12 deletions(-)
diff --git a/pyproject.toml b/pyproject.toml
index 8aa49aa..10fa20e 100644
index 0812e11..3ead0e0 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -56,12 +56,6 @@ classifiers = [
"Topic :: Utilities",
]
dependencies = [
- "sphinxcontrib-applehelp",
- "sphinxcontrib-devhelp",
- "sphinxcontrib-jsmath",
- "sphinxcontrib-htmlhelp>=2.0.0",
- "sphinxcontrib-applehelp>=1.0.7",
- "sphinxcontrib-devhelp>=1.0.6",
- "sphinxcontrib-htmlhelp>=2.0.6",
- "sphinxcontrib-jsmath>=1.0.1",
- "sphinxcontrib-qthelp>=1.0.6",
- "sphinxcontrib-serializinghtml>=1.1.9",
- "sphinxcontrib-qthelp",
"Jinja2>=3.0",
"Pygments>=2.14",
"docutils>=0.18.1,<0.22",
@@ -78,8 +72,35 @@ dependencies = [
"Jinja2>=3.1",
"Pygments>=2.17",
"docutils>=0.20,<0.22",
@@ -77,8 +71,35 @@ dependencies = [
dynamic = ["version"]
[project.optional-dependencies]
+applehelp = [
+ "sphinxcontrib-applehelp",
+ "sphinxcontrib-applehelp>=1.0.7",
+]
+devhelp = [
+ "sphinxcontrib-devhelp",
+ "sphinxcontrib-devhelp>=1.0.6",
+]
+jsmath = [
+ "sphinxcontrib-jsmath",
+ "sphinxcontrib-jsmath>=1.0.1",
+]
+htmlhelp = [
+ "sphinxcontrib-htmlhelp>=2.0.0",
+ "sphinxcontrib-htmlhelp>=2.0.6",
+]
+serializinghtml = [
+ "sphinxcontrib-serializinghtml>=1.1.9",
+]
+qthelp = [
+ "sphinxcontrib-qthelp",
+ "sphinxcontrib-qthelp>=1.0.6",
+]
+extensions = [
+ "sphinx[applehelp]",
@@ -67,12 +69,12 @@ index 8aa49aa..10fa20e 100644
+ "sphinx[extensions]",
]
lint = [
"flake8>=3.5.0",
"flake8>=6.0",
diff --git a/sphinx/application.py b/sphinx/application.py
index 7d16d9a..2a71074 100644
index 872dd7a..21f9be0 100644
--- a/sphinx/application.py
+++ b/sphinx/application.py
@@ -222,7 +222,7 @@ class Sphinx:
@@ -249,7 +249,7 @@ class Sphinx:
# load all built-in extension modules, first-party extension modules,
# and first-party themes
for extension in builtin_extensions:
@@ -81,7 +83,7 @@ index 7d16d9a..2a71074 100644
# load all user-given extension modules
for extension in self.config.extensions:
@@ -391,7 +391,7 @@ class Sphinx:
@@ -426,7 +426,7 @@ class Sphinx:
# ---- general extensibility interface -------------------------------------
@@ -90,7 +92,7 @@ index 7d16d9a..2a71074 100644
"""Import and setup a Sphinx extension module.
Load the extension given by the module *name*. Use this if your
@@ -399,7 +399,7 @@ class Sphinx:
@@ -434,7 +434,7 @@ class Sphinx:
called twice.
"""
logger.debug('[app] setting up extension: %r', extname)
@@ -100,7 +102,7 @@ index 7d16d9a..2a71074 100644
@staticmethod
def require_sphinx(version: tuple[int, int] | str) -> None:
diff --git a/sphinx/registry.py b/sphinx/registry.py
index 7887858..ca95960 100644
index da21aef..c3f87e0 100644
--- a/sphinx/registry.py
+++ b/sphinx/registry.py
@@ -436,7 +436,7 @@ class SphinxComponentRegistry:
@@ -128,11 +130,11 @@ index 7887858..ca95960 100644
setup: _ExtensionSetupFunc | None = getattr(mod, 'setup', None)
if setup is None:
diff --git a/sphinx/testing/fixtures.py b/sphinx/testing/fixtures.py
index 6e1a122..f3fe743 100644
index 6f1c29c..425e026 100644
--- a/sphinx/testing/fixtures.py
+++ b/sphinx/testing/fixtures.py
@@ -31,6 +31,7 @@ DEFAULT_ENABLED_MARKERS = [
'keep_going=False, builddir=None, docutils_conf=None'
'builddir=None, docutils_conf=None'
'): arguments to initialize the sphinx test application.'
),
+ 'sphinxcontrib(...): required sphinxcontrib.* extensions',
@@ -153,53 +155,53 @@ index 6e1a122..f3fe743 100644
pargs: dict[int, Any] = {}
diff --git a/tests/test_builders/test_build_html_maths.py b/tests/test_builders/test_build_html_maths.py
index 900846b..664c86e 100644
index 0f77691..bc87e98 100644
--- a/tests/test_builders/test_build_html_maths.py
+++ b/tests/test_builders/test_build_html_maths.py
@@ -20,6 +20,7 @@ def test_html_math_renderer_is_imgmath(app, status, warning):
@@ -26,6 +26,7 @@ def test_html_math_renderer_is_imgmath(app):
assert app.builder.math_renderer_name == 'imgmath'
+@pytest.mark.sphinxcontrib('serializinghtml', 'jsmath')
@pytest.mark.sphinx('html', testroot='basic',
confoverrides={'extensions': ['sphinxcontrib.jsmath',
'sphinx.ext.imgmath']})
@@ -40,6 +41,7 @@ def test_html_math_renderer_is_duplicated2(app, status, warning):
@pytest.mark.sphinx(
'html',
testroot='basic',
@@ -50,6 +51,7 @@ def test_html_math_renderer_is_duplicated2(app):
assert app.builder.math_renderer_name == 'imgmath' # The another one is chosen
+@pytest.mark.sphinxcontrib('jsmath')
@pytest.mark.sphinx('html', testroot='basic',
confoverrides={'extensions': ['sphinxcontrib.jsmath',
'sphinx.ext.imgmath'],
@@ -48,6 +50,7 @@ def test_html_math_renderer_is_chosen(app, status, warning):
@pytest.mark.sphinx(
'html',
testroot='basic',
@@ -62,6 +64,7 @@ def test_html_math_renderer_is_chosen(app):
assert app.builder.math_renderer_name == 'imgmath'
+@pytest.mark.sphinxcontrib('jsmath')
@pytest.mark.sphinx('html', testroot='basic',
confoverrides={'extensions': ['sphinxcontrib.jsmath',
'sphinx.ext.mathjax'],
@pytest.mark.sphinx(
'html',
testroot='basic',
diff --git a/tests/test_writers/test_api_translator.py b/tests/test_writers/test_api_translator.py
index 9f2bd44..81575b7 100644
index bdbea0d..01d4d35 100644
--- a/tests/test_writers/test_api_translator.py
+++ b/tests/test_writers/test_api_translator.py
@@ -36,6 +36,7 @@ def test_singlehtml_set_translator_for_singlehtml(app, status, warning):
@@ -36,6 +36,7 @@ def test_singlehtml_set_translator_for_singlehtml(app):
assert translator_class.__name__ == 'ConfSingleHTMLTranslator'
+@pytest.mark.sphinxcontrib('serializinghtml')
@pytest.mark.sphinx('pickle', testroot='api-set-translator')
def test_pickle_set_translator_for_pickle(app, status, warning):
def test_pickle_set_translator_for_pickle(app):
translator_class = app.builder.get_translator_class()
@@ -43,6 +44,7 @@ def test_pickle_set_translator_for_pickle(app, status, warning):
@@ -43,6 +44,7 @@ def test_pickle_set_translator_for_pickle(app):
assert translator_class.__name__ == 'ConfPickleTranslator'
+@pytest.mark.sphinxcontrib('serializinghtml')
@pytest.mark.sphinx('json', testroot='api-set-translator')
def test_json_set_translator_for_json(app, status, warning):
def test_json_set_translator_for_json(app):
translator_class = app.builder.get_translator_class()
--
2.44.0
2.47.0

5
plan.fmf Normal file
View File

@@ -0,0 +1,5 @@
discover:
how: fmf
execute:
how: tmt

View File

@@ -19,7 +19,7 @@
%bcond latex_tests 1
Name: python-sphinx
%global general_version 7.3.7
%global general_version 8.1.3
#global prerel ...
%global upstream_version %{general_version}%{?prerel}
Version: %{general_version}%{?prerel:~%{prerel}}
@@ -54,12 +54,6 @@ Patch: sphinx-test_theming.patch
# https://github.com/sphinx-doc/sphinx/pull/11747
Patch: Make-the-first-party-extensions-optional.patch
# Fix tests with Python 3.13+
Patch: https://github.com/sphinx-doc/sphinx/pull/12373.patch
# Lazily import defusedxml only when necessary
Patch: https://github.com/sphinx-doc/sphinx/pull/12362.patch
BuildArch: noarch
BuildRequires: make

View File

@@ -1 +1 @@
SHA512 (sphinx-7.3.7.tar.gz) = f450eaaa26a0989e9065174e23488a7f647221750238516c5d06d403540eb4277fd480f03857d24acb6b7335458ae4535ad1ad533eff6d3bbba5521d9a6deb14
SHA512 (sphinx-8.1.3.tar.gz) = 938fc78941fd7b2bf3382730f2f9d322d406f87c80c0e4bf4c051a85a352c2c6241fe5b8d21574de7e4c1528090955eb84b6d23813b377b2be198a2cfa70221f

View File

@@ -0,0 +1,11 @@
summary: run the basic documentation build
test: |
sphinx-build -M html source/ build/ &&
grep '<script src="_static/jquery.js' build/html/index.html &&
grep '<script src="_static/_sphinx_javascript_frameworks_compat.js' build/html/index.html &&
test -f build/html/_static/jquery.js &&
test -f build/html/_static/_sphinx_javascript_frameworks_compat.js &&
rm -rf build/
require:
- python3-sphinx
- python3-sphinxcontrib-jquery

View File

@@ -0,0 +1,7 @@
project = 'Test'
copyright = '2024, Test'
author = 'Test'
release = '0.3.0'
extensions = [
"sphinxcontrib.jquery",
]

View File

@@ -0,0 +1,15 @@
Test docfile
============
.. toctree::
:maxdepth: 2
:caption: Contents:
Indices and tables
==================
* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`

View File

@@ -0,0 +1,10 @@
summary: run the basic documentation build
test: |
sphinx-build -M html source/ build/ &&
grep '<section id="test-docfile">' build/html/index.html &&
grep '<h1>Test docfile' build/html/index.html &&
grep '_static/alabaster.css' build/html/index.html &&
rm -rf build/
require:
- python3-sphinx
- python3-sphinx-theme-alabaster

View File

@@ -0,0 +1,5 @@
project = 'Test'
copyright = '2024, Test'
author = 'Test'
release = '0.3.0'
html_theme = 'alabaster'

View File

@@ -0,0 +1,15 @@
Test docfile
============
.. toctree::
:maxdepth: 2
:caption: Contents:
Indices and tables
==================
* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`

View File

@@ -0,0 +1,11 @@
summary: run the basic documentation build with sphinx-rtd-theme
test: |
sphinx-build -M html source/ build/ &&
grep '<section id="test-docfile">' build/html/index.html &&
grep '<h1>Test docfile' build/html/index.html &&
grep 'SphinxRtdTheme' build/html/_static/js/theme.js &&
grep '<script src="_static/js/theme.js' build/html/index.html &&
rm -rf build/
require:
- python3-sphinx
- python3-sphinx_rtd_theme

View File

@@ -0,0 +1,8 @@
project = 'Test'
copyright = '2024, Test'
author = 'Test'
release = '0.3.0'
html_theme = 'sphinx_rtd_theme'
extensions = [
'sphinx_rtd_theme',
]

View File

@@ -0,0 +1,15 @@
Test docfile
============
.. toctree::
:maxdepth: 2
:caption: Contents:
Indices and tables
==================
* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`