Require Docutils 0.21 or greater (#14154)

This commit is contained in:
Adam Turner authored and GitHub committed 2025-12-05 22:37:44 +00:00
1 parent ad0497b89d
commit a5e373ce51
7 files changed
+13 -37

No files matched your search

+1 -3
View File
@@ -75,12 +75,10 @@ def test_html_scaled_image_link(app: SphinxTestApp) -> None:
context,
)
else:
# Docutils 0.21 adds a newline before the closing </a> tag
closing_space = '\n' if docutils.__version_info__[:2] >= (0, 21) else ''
assert re.search(
'\n<a class="reference internal image-reference" href="_images/img.png">'
'<img alt="_images/img.png" src="_images/img.png" style="[^"]+" />'
f'{closing_space}</a>',
'\n</a>',
context,
)
+1 -6
View File
@@ -15,7 +15,6 @@ from queue import Queue
from typing import TYPE_CHECKING
from unittest import mock
import docutils
import pytest
from urllib3.poolmanager import PoolManager
@@ -177,11 +176,7 @@ def test_defaults(app: SphinxTestApp) -> None:
'info': f'404 Client Error: Not Found for url: http://{address}/{filename}',
}
accurate_linenumbers = docutils.__version_info__[:2] >= (0, 21)
image2_lineno = 12 if accurate_linenumbers else 13
assert rowsby[f'http://{address}/image2.png'] == _missing_resource(
'image2.png', image2_lineno
)
assert rowsby[f'http://{address}/image2.png'] == _missing_resource('image2.png', 12)
# looking for '#top' and '#does-not-exist' not found should fail
assert rowsby[f'http://{address}/#top']['info'] == "Anchor 'top' not found"
assert rowsby[f'http://{address}/#top']['status'] == 'broken'
+1 -20
View File
@@ -4,7 +4,6 @@ from __future__ import annotations
from typing import TYPE_CHECKING
import docutils
import pytest
from sphinx.builders.manpage import default_man_pages
@@ -65,25 +64,7 @@ def test_captioned_code_block(app: SphinxTestApp) -> None:
app.build(force_all=True)
content = (app.outdir / 'projectnamenotset.1').read_text(encoding='utf8')
if docutils.__version_info__[:2] < (0, 21):
expected = """\
.sp
caption \\fItest\\fP rb
.INDENT 0.0
.INDENT 3.5
.sp
.nf
.ft C
def ruby?
false
end
.ft P
.fi
.UNINDENT
.UNINDENT
"""
else:
expected = """\
expected = """\
.sp
caption \\fItest\\fP rb
.INDENT 0.0