Skip to content

Commit

Permalink
🧪 Fix tests for sphinx 7.3 (#915)
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisjsewell authored Apr 23, 2024
1 parent 707e8a4 commit 95e5ca7
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 5 deletions.
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ rtd = [
testing = [
"beautifulsoup4",
"coverage[toml]",
"defusedxml", # required by sphinx 7.3 testing utils
"pytest>=8,<9",
"pytest-cov",
"pytest-regressions",
Expand Down
9 changes: 8 additions & 1 deletion tests/test_renderers/test_fixtures_sphinx.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,12 @@
def test_syntax_elements(file_params, sphinx_doctree_no_tr: CreateDoctree):
sphinx_doctree_no_tr.set_conf({"extensions": ["myst_parser"]})
result = sphinx_doctree_no_tr(file_params.content, "index.md")
file_params.assert_expected(result.pformat("index"), rstrip_lines=True)
pformat = result.pformat("index")
# changed in docutils 0.20.1
pformat = pformat.replace(
'<literal classes="code" language="">', '<literal classes="code">'
)
file_params.assert_expected(pformat, rstrip_lines=True)


@pytest.mark.param_file(FIXTURE_PATH / "sphinx_link_resolution.md")
Expand Down Expand Up @@ -100,6 +105,8 @@ def test_sphinx_directives(file_params, sphinx_doctree_no_tr: CreateDoctree):
),
"",
)
# changed in sphinx 7.3
pformat = pformat.replace("Added in version 0.2", "New in version 0.2")

file_params.assert_expected(pformat, rstrip_lines=True)

Expand Down
1 change: 1 addition & 0 deletions tests/test_sphinx/sourcedirs/heading_slug_func/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@

extensions = ["myst_parser"]
exclude_patterns = ["_build"]
suppress_warnings = ["config.cache"]
myst_heading_anchors = 2
myst_heading_slug_func = make_id
18 changes: 15 additions & 3 deletions tests/test_sphinx/test_sphinx_builds.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,15 +162,25 @@ def test_references_singlehtml(
docname="other/other",
resolve=True,
regress=True,
replace={"other\\other.md": "other/other.md"},
replace={
"other\\other.md": "other/other.md",
# changed in sphinx 7.3
'="#document-index': '="index.html#document-index',
'="#document-other': '="index.html#document-other',
},
)

get_sphinx_app_output(
app,
filename="index.html",
buildername="singlehtml",
regress_html=True,
replace={"Permalink to this headline": "Permalink to this heading"},
replace={
"Permalink to this headline": "Permalink to this heading",
# changed in sphinx 7.3
'="#document-index': '="index.html#document-index',
'="#document-other': '="index.html#document-other',
},
)


Expand Down Expand Up @@ -469,7 +479,9 @@ def test_gettext_html(
regress_ext=".html",
replace={
# upstream bug https://github.com/sphinx-doc/sphinx/issues/11689
'"Permalink to this heading"': '"Lien permanent vers cette rubrique"'
'"Permalink to this heading"': '"Lien permanent vers cette rubrique"',
# which was fixed to a different translation in sphinx 7.3
'"Lien vers cette rubrique"': '"Lien permanent vers cette rubrique"',
},
)

Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
# then then deleting compiled files has been found to fix it: `find . -name \*.pyc -delete`

[tox]
envlist = py38-sphinx7
envlist = py39-sphinx7

[testenv]
usedevelop = true
Expand Down

0 comments on commit 95e5ca7

Please sign in to comment.