diff --git a/pyproject.toml b/pyproject.toml index 83d8de0d018..b29fa9c90cc 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -257,7 +257,6 @@ module = [ "tests.test_builders.test_build_html_assets", "tests.test_builders.test_build_html_maths", "tests.test_builders.test_build_html_numfig", - "tests.test_builders.test_build_html_tocdepth", "tests.test_builders.test_build_html_toctree", "tests.test_builders.test_build_linkcheck", "tests.test_builders.test_build_warnings", diff --git a/tests/test_builders/test_build_html_tocdepth.py b/tests/test_builders/test_build_html_tocdepth.py index 003ba02e5f0..0fe83e0ff34 100644 --- a/tests/test_builders/test_build_html_tocdepth.py +++ b/tests/test_builders/test_build_html_tocdepth.py @@ -2,11 +2,20 @@ from __future__ import annotations +from typing import TYPE_CHECKING + import pytest from tests.test_builders.xpath_html_util import _intradocument_hyperlink_check from tests.test_builders.xpath_util import check_xpath +if TYPE_CHECKING: + from collections.abc import Callable + from pathlib import Path + from xml.etree.ElementTree import ElementTree + + from sphinx.testing.util import SphinxTestApp + @pytest.mark.parametrize( ('fname', 'path', 'check', 'be_found'), @@ -68,7 +77,14 @@ ) @pytest.mark.sphinx('html', testroot='tocdepth') @pytest.mark.test_params(shared_result='test_build_html_tocdepth') -def test_tocdepth(app, cached_etree_parse, fname, path, check, be_found): +def test_tocdepth( + app: SphinxTestApp, + cached_etree_parse: Callable[[Path], ElementTree], + fname: str, + path: str, + check: str, + be_found: bool, +) -> None: app.build() # https://github.com/sphinx-doc/sphinx/issues/1251 check_xpath(cached_etree_parse(app.outdir / fname), fname, path, check, be_found) @@ -111,6 +127,10 @@ def test_tocdepth(app, cached_etree_parse, fname, path, check, be_found): ) @pytest.mark.sphinx('singlehtml', testroot='tocdepth') @pytest.mark.test_params(shared_result='test_build_html_tocdepth') -def test_tocdepth_singlehtml(app, cached_etree_parse, expect): +def test_tocdepth_singlehtml( + app: SphinxTestApp, + cached_etree_parse: Callable[[Path], ElementTree], + expect: tuple[str, str, bool], +) -> None: app.build() check_xpath(cached_etree_parse(app.outdir / 'index.html'), 'index.html', *expect)