dev-python/sphinx-panels: fix test w/ docutils-0.22

apply Debian' patch for docutils
rebase the patch for sphinx-7.2, testing.path is removed since 9.0

Closes: https://bugs.gentoo.org/962897
Signed-off-by: Nicolas PARLANT <nicolas.parlant@parhuet.fr>
Part-of: https://codeberg.org/gentoo/gentoo/pulls/1148
Signed-off-by: Nowa Ammerlaan <nowa@gentoo.org>
This commit is contained in:
Nicolas PARLANT
2026-06-12 09:52:21 +02:00
committed by Nowa Ammerlaan
parent 4c7fa7d8ab
commit b49bf814e0
3 changed files with 120 additions and 18 deletions

View File

@@ -0,0 +1,110 @@
from Debian https://salsa.debian.org/python-team/packages/sphinx-panels/-/blob/debian/0.6.0-7/debian/patches/Make-the-tests-pass-with-Docutils-0.22.patch
Bug #962897 / Make the tests pass with Docutils 0.22
--- a/tests/test_sphinx.py
+++ b/tests/test_sphinx.py
@@ -1,8 +1,10 @@
from pathlib import Path
import shutil
+import docutils
import pytest
import sphinx
+from docutils.nodes import Element
from sphinx_panels.tabs import TabbedHtmlTransform
@@ -34,6 +36,11 @@ def test_sources(sphinx_app_factory, file_regression, folder):
doctree["source"] = "source"
if sphinx.version_info < (7, 1):
doctree["translation_progress"] = "{'total': 0, 'translated': 0}"
+ if docutils.__version_info__ < (0, 22):
+ for node in doctree.findall(Element):
+ for name, value in node.attlist():
+ if isinstance(value, bool):
+ node.attributes[name] = str(int(value))
file_regression.check(
doctree.pformat(),
encoding="utf8",
--- a/tests/test_sphinx/test_sources_dropdown_basic_.xml
+++ b/tests/test_sphinx/test_sources_dropdown_basic_.xml
@@ -2,27 +2,27 @@
<section ids="title" names="title">
<title>
Title
- <dropdown_main classes="sphinx-bs dropdown card mb-3 shadow" opened="False">
+ <dropdown_main classes="sphinx-bs dropdown card mb-3 shadow" opened="0">
<dropdown_title classes="summary-title card-header bg-primary text-white text-center font-weight-bold">
My Content
- <container classes="summary-down" is_div="True">
+ <container classes="summary-down" is_div="1">
<raw format="html" xml:space="preserve">
<svg version="1.1" width="24" height="24" class="octicon octicon-chevron-down" viewBox="0 0 24 24" aria-hidden="true"><path fill-rule="evenodd" d="M5.22 8.72a.75.75 0 000 1.06l6.25 6.25a.75.75 0 001.06 0l6.25-6.25a.75.75 0 00-1.06-1.06L12 14.44 6.28 8.72a.75.75 0 00-1.06 0z"></path></svg>
- <container classes="summary-up" is_div="True">
+ <container classes="summary-up" is_div="1">
<raw format="html" xml:space="preserve">
<svg version="1.1" width="24" height="24" class="octicon octicon-chevron-up" viewBox="0 0 24 24" aria-hidden="true"><path fill-rule="evenodd" d="M18.78 15.28a.75.75 0 000-1.06l-6.25-6.25a.75.75 0 00-1.06 0l-6.25 6.25a.75.75 0 101.06 1.06L12 9.56l5.72 5.72a.75.75 0 001.06 0z"></path></svg>
- <container classes="summary-content card-body bg-light text-right font-italic" is_div="True">
+ <container classes="summary-content card-body bg-light text-right font-italic" is_div="1">
<paragraph classes="card-text">
Is formatted
- <dropdown_main classes="sphinx-bs dropdown card mb-3 fade-in-slide-down" opened="False">
+ <dropdown_main classes="sphinx-bs dropdown card mb-3 fade-in-slide-down" opened="0">
<dropdown_title classes="summary-title card-header">
Fade In
- <container classes="summary-down" is_div="True">
+ <container classes="summary-down" is_div="1">
<raw format="html" xml:space="preserve">
<svg version="1.1" width="24" height="24" class="octicon octicon-chevron-down" viewBox="0 0 24 24" aria-hidden="true"><path fill-rule="evenodd" d="M5.22 8.72a.75.75 0 000 1.06l6.25 6.25a.75.75 0 001.06 0l6.25-6.25a.75.75 0 00-1.06-1.06L12 14.44 6.28 8.72a.75.75 0 00-1.06 0z"></path></svg>
- <container classes="summary-up" is_div="True">
+ <container classes="summary-up" is_div="1">
<raw format="html" xml:space="preserve">
<svg version="1.1" width="24" height="24" class="octicon octicon-chevron-up" viewBox="0 0 24 24" aria-hidden="true"><path fill-rule="evenodd" d="M18.78 15.28a.75.75 0 000-1.06l-6.25-6.25a.75.75 0 00-1.06 0l-6.25 6.25a.75.75 0 101.06 1.06L12 9.56l5.72 5.72a.75.75 0 001.06 0z"></path></svg>
- <container classes="summary-content card-body" is_div="True">
+ <container classes="summary-content card-body" is_div="1">
<paragraph classes="card-text">
Content
--- a/tests/test_sphinx/test_sources_tabbed_basic_.xml
+++ b/tests/test_sphinx/test_sources_tabbed_basic_.xml
@@ -2,31 +2,31 @@
<section ids="title" names="title">
<title>
Title
- <container classes="tabbed-set" is_div="True">
- <tabbed_input checked="True" id="mock-uuid" set_id="mock-uuid" type="radio">
+ <container classes="tabbed-set" is_div="1">
+ <tabbed_input checked="1" id="mock-uuid" set_id="mock-uuid" type="radio">
<tabbed_label classes="tabbed-label" input_id="mock-uuid">
Tab 1
- <container classes="tabbed-content" is_div="True">
+ <container classes="tabbed-content" is_div="1">
<paragraph>
Tab 1 content
- <tabbed_input checked="False" id="mock-uuid" set_id="mock-uuid" type="radio">
+ <tabbed_input checked="0" id="mock-uuid" set_id="mock-uuid" type="radio">
<tabbed_label classes="tabbed-label" input_id="mock-uuid">
Tab 2
- <container classes="tabbed-content pl-1 bg-primary" is_div="True">
+ <container classes="tabbed-content pl-1 bg-primary" is_div="1">
<paragraph>
Tab 2 content
- <container classes="tabbed-set" is_div="True">
- <tabbed_input checked="False" id="mock-uuid" set_id="mock-uuid" type="radio">
+ <container classes="tabbed-set" is_div="1">
+ <tabbed_input checked="0" id="mock-uuid" set_id="mock-uuid" type="radio">
<tabbed_label classes="tabbed-label" input_id="mock-uuid">
Tab 3
- <container classes="tabbed-content" is_div="True">
+ <container classes="tabbed-content" is_div="1">
<paragraph>
Tab 3 content
- <literal_block force="False" highlight_args="{}" language="python" linenos="False" xml:space="preserve">
+ <literal_block force="0" highlight_args="{}" language="python" linenos="0" xml:space="preserve">
import pip
- <tabbed_input checked="True" id="mock-uuid" set_id="mock-uuid" type="radio">
+ <tabbed_input checked="1" id="mock-uuid" set_id="mock-uuid" type="radio">
<tabbed_label classes="tabbed-label" input_id="mock-uuid">
Tab 4
- <container classes="tabbed-content" is_div="True">
+ <container classes="tabbed-content" is_div="1">
<paragraph>
Tab 4 content

View File

@@ -1,34 +1,28 @@
https://salsa.debian.org/python-team/packages/sphinx-panels/-/blob/debian/master/debian/patches/Make-the-tests-pass-with-Sphinx-7.x.patch
https://salsa.debian.org/python-team/packages/sphinx-panels/-/blob/debian/0.6.0-7/debian/patches/Make-the-tests-pass-with-Sphinx-7.x.patch
From: Dmitry Shachnev <mitya57@debian.org>
Date: Fri, 3 Nov 2023 23:25:11 +0300
Subject: Make the tests pass with Sphinx 7.x
---
tests/test_sphinx.py | 8 +++++++-
tests/test_sphinx/test_sources_dropdown_basic_.xml | 2 +-
tests/test_sphinx/test_sources_tabbed_basic_.xml | 2 +-
3 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/tests/test_sphinx.py b/tests/test_sphinx.py
index 9efc2c2..35affa1 100644
Forwarded: https://github.com/executablebooks/sphinx-panels/pull/84
--- a/tests/test_sphinx.py
+++ b/tests/test_sphinx.py
@@ -2,6 +2,7 @@ from pathlib import Path
@@ -2,7 +2,7 @@ from pathlib import Path
import shutil
import pytest
-from sphinx.testing.path import path
+import sphinx
from sphinx.testing.path import path
from sphinx_panels.tabs import TabbedHtmlTransform
@@ -15,7 +16,10 @@ def sphinx_app_factory(make_app, tmp_path: Path, monkeypatch):
@@ -15,7 +15,11 @@ def sphinx_app_factory(make_app, tmp_path: Path, monkeypatch):
shutil.copytree(
(Path(__file__).parent / "sources" / src_folder), tmp_path / src_folder
)
- app = make_app(srcdir=path(str((tmp_path / src_folder).absolute())), **kwargs)
+ srcdir = (tmp_path / src_folder).absolute()
+ if sphinx.version_info < (7, 2):
+ from sphinx.testing.path import path
+ srcdir = path(str(srcdir))
+ app = make_app(srcdir=srcdir, **kwargs)
return app
@@ -43,8 +37,6 @@ index 9efc2c2..35affa1 100644
file_regression.check(
doctree.pformat(),
encoding="utf8",
diff --git a/tests/test_sphinx/test_sources_dropdown_basic_.xml b/tests/test_sphinx/test_sources_dropdown_basic_.xml
index b984330..4c42825 100644
--- a/tests/test_sphinx/test_sources_dropdown_basic_.xml
+++ b/tests/test_sphinx/test_sources_dropdown_basic_.xml
@@ -1,4 +1,4 @@
@@ -53,8 +45,6 @@ index b984330..4c42825 100644
<section ids="title" names="title">
<title>
Title
diff --git a/tests/test_sphinx/test_sources_tabbed_basic_.xml b/tests/test_sphinx/test_sources_tabbed_basic_.xml
index b3f2d1a..f55e06e 100644
--- a/tests/test_sphinx/test_sources_tabbed_basic_.xml
+++ b/tests/test_sphinx/test_sources_tabbed_basic_.xml
@@ -1,4 +1,4 @@

View File

@@ -1,4 +1,4 @@
# Copyright 1999-2025 Gentoo Authors
# Copyright 1999-2026 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
@@ -35,6 +35,8 @@ BDEPEND="
PATCHES=(
# https://github.com/executablebooks/sphinx-panels/pull/84
"${FILESDIR}/${P}-sphinx-7.patch"
# rebased https://github.com/executablebooks/sphinx-panels/pull/86
"${FILESDIR}/${P}-docutils-0.22.patch"
)
distutils_enable_tests pytest