Skip to content

Commit 95e5ca7

Browse files
authored
🧪 Fix tests for sphinx 7.3 (#915)
1 parent 707e8a4 commit 95e5ca7

File tree

5 files changed

+26
-5
lines changed

5 files changed

+26
-5
lines changed

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ rtd = [
7070
testing = [
7171
"beautifulsoup4",
7272
"coverage[toml]",
73+
"defusedxml", # required by sphinx 7.3 testing utils
7374
"pytest>=8,<9",
7475
"pytest-cov",
7576
"pytest-regressions",

tests/test_renderers/test_fixtures_sphinx.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,12 @@
2222
def test_syntax_elements(file_params, sphinx_doctree_no_tr: CreateDoctree):
2323
sphinx_doctree_no_tr.set_conf({"extensions": ["myst_parser"]})
2424
result = sphinx_doctree_no_tr(file_params.content, "index.md")
25-
file_params.assert_expected(result.pformat("index"), rstrip_lines=True)
25+
pformat = result.pformat("index")
26+
# changed in docutils 0.20.1
27+
pformat = pformat.replace(
28+
'<literal classes="code" language="">', '<literal classes="code">'
29+
)
30+
file_params.assert_expected(pformat, rstrip_lines=True)
2631

2732

2833
@pytest.mark.param_file(FIXTURE_PATH / "sphinx_link_resolution.md")
@@ -100,6 +105,8 @@ def test_sphinx_directives(file_params, sphinx_doctree_no_tr: CreateDoctree):
100105
),
101106
"",
102107
)
108+
# changed in sphinx 7.3
109+
pformat = pformat.replace("Added in version 0.2", "New in version 0.2")
103110

104111
file_params.assert_expected(pformat, rstrip_lines=True)
105112

tests/test_sphinx/sourcedirs/heading_slug_func/conf.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@
22

33
extensions = ["myst_parser"]
44
exclude_patterns = ["_build"]
5+
suppress_warnings = ["config.cache"]
56
myst_heading_anchors = 2
67
myst_heading_slug_func = make_id

tests/test_sphinx/test_sphinx_builds.py

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -162,15 +162,25 @@ def test_references_singlehtml(
162162
docname="other/other",
163163
resolve=True,
164164
regress=True,
165-
replace={"other\\other.md": "other/other.md"},
165+
replace={
166+
"other\\other.md": "other/other.md",
167+
# changed in sphinx 7.3
168+
'="#document-index': '="index.html#document-index',
169+
'="#document-other': '="index.html#document-other',
170+
},
166171
)
167172

168173
get_sphinx_app_output(
169174
app,
170175
filename="index.html",
171176
buildername="singlehtml",
172177
regress_html=True,
173-
replace={"Permalink to this headline": "Permalink to this heading"},
178+
replace={
179+
"Permalink to this headline": "Permalink to this heading",
180+
# changed in sphinx 7.3
181+
'="#document-index': '="index.html#document-index',
182+
'="#document-other': '="index.html#document-other',
183+
},
174184
)
175185

176186

@@ -469,7 +479,9 @@ def test_gettext_html(
469479
regress_ext=".html",
470480
replace={
471481
# upstream bug https://github.com/sphinx-doc/sphinx/issues/11689
472-
'"Permalink to this heading"': '"Lien permanent vers cette rubrique"'
482+
'"Permalink to this heading"': '"Lien permanent vers cette rubrique"',
483+
# which was fixed to a different translation in sphinx 7.3
484+
'"Lien vers cette rubrique"': '"Lien permanent vers cette rubrique"',
473485
},
474486
)
475487

tox.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
# then then deleting compiled files has been found to fix it: `find . -name \*.pyc -delete`
1212

1313
[tox]
14-
envlist = py38-sphinx7
14+
envlist = py39-sphinx7
1515

1616
[testenv]
1717
usedevelop = true

0 commit comments

Comments
 (0)