python-breathe/support-sphinx-7.4.patch

73 lines
2.5 KiB
Diff

From 44c113677bbb5c5292f6e69fb9f614334eedcb3e Mon Sep 17 00:00:00 2001
From: "Eric T. Johnson" <yut23@users.noreply.github.com>
Date: Thu, 16 Jan 2025 11:49:54 -0500
Subject: [PATCH] Fix tests for Sphinx 7.4 (#1007)
---
breathe/file_state_cache.py | 2 ++
breathe/process.py | 2 ++
tests/test_renderer.py | 9 +++++----
3 files changed, 9 insertions(+), 4 deletions(-)
--- a/breathe/file_state_cache.py
+++ b/breathe/file_state_cache.py
@@ -1,3 +1,5 @@
+from __future__ import annotations
+
from sphinx.application import Sphinx
from sphinx.environment import BuildEnvironment
--- a/breathe/process.py
+++ b/breathe/process.py
@@ -1,3 +1,5 @@
+from __future__ import annotations
+
from breathe.project import AutoProjectInfo, ProjectInfoFactory
import os
--- a/tests/test_renderer.py
+++ b/tests/test_renderer.py
@@ -40,7 +40,7 @@ def app(test_params, app_params, make_ap
except AttributeError:
# old version of Sphinx
kwargs["srcdir"].makedirs(exist_ok=True)
- (kwargs["srcdir"] / "conf.py").write_text("")
+ (kwargs["srcdir"] / "conf.py").write_text("", encoding="ascii")
app_ = make_app(*args, **kwargs)
yield app_
@@ -129,7 +129,7 @@ class MockState:
env.temp_data["docname"] = "mock-doc"
env.temp_data["breathe_project_info_factory"] = ProjectInfoFactory(app)
env.temp_data["breathe_parser_factory"] = DoxygenParserFactory(app)
- settings = frontend.OptionParser(components=(parsers.rst.Parser,)).get_default_values()
+ settings = frontend.get_default_settings(parsers.rst.Parser)
settings.env = env
self.document = utils.new_document("", settings)
@@ -172,13 +172,14 @@ class MockMaskFactory:
class MockContext:
def __init__(self, app, node_stack, domain=None, options=[]):
+ from docutils.statemachine import StringList
self.domain = domain
self.node_stack = node_stack
self.directive_args = [
None, # name
None, # arguments
options, # options
- None, # content
+ StringList([], items=[]), # content
None, # lineno
None, # content_offset
None, # block_text
@@ -564,7 +565,7 @@ def get_matches(datafile):
from xml.dom import minidom
argsstrings = []
- with open(os.path.join(os.path.dirname(__file__), "data", datafile)) as fid:
+ with open(os.path.join(os.path.dirname(__file__), "data", datafile), encoding="utf-8") as fid:
xml = fid.read()
doc = minidom.parseString(xml)