Skip to content

Commit 5cf6b49

Browse files
committed
Fix test case for Sphinx < 8.2
1 parent eb9da37 commit 5cf6b49

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

tests/test_needs_external_needs_build.py

+11-5
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
import pytest
66
import responses
77
from docutils import __version__ as doc_ver
8+
from sphinx import version_info
9+
from sphinx.testing.util import SphinxTestApp
810
from sphinx.util.console import strip_colors
911

1012

@@ -13,13 +15,11 @@
1315
[{"buildername": "html", "srcdir": "doc_test/doc_needs_external_needs"}],
1416
indirect=True,
1517
)
16-
def test_doc_build_html(test_app, sphinx_test_tempdir):
18+
def test_doc_build_html(test_app: SphinxTestApp, sphinx_test_tempdir):
1719
import subprocess
1820

19-
app = test_app
20-
21-
src_dir = Path(app.srcdir)
22-
out_dir = Path(app.outdir)
21+
src_dir = Path(test_app.srcdir)
22+
out_dir = Path(test_app.outdir)
2323
plantuml = r"java -Djava.awt.headless=true -jar {}".format(
2424
os.path.join(sphinx_test_tempdir, "utils", "plantuml.jar")
2525
)
@@ -39,6 +39,12 @@ def test_doc_build_html(test_app, sphinx_test_tempdir):
3939
["sphinx-build", "-b", "html", "-D", rf"plantuml={plantuml}", src_dir, out_dir],
4040
capture_output=True,
4141
)
42+
43+
# Sphinx 8.2 removed an early return in case no documents were updated in
44+
# https://github.com/sphinx-doc/sphinx/pull/13236
45+
# which leads to SN warnings not being emitted
46+
if version_info < (8, 2):
47+
expected_warnings = []
4248
assert (
4349
strip_colors(output_second.stderr.decode("utf-8")).splitlines()
4450
== expected_warnings

0 commit comments

Comments
 (0)