Skip to content

Remove mypy overrides for tests/test_builders/test_build_html_tocdept… #13696

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
24 changes: 22 additions & 2 deletions tests/test_builders/test_build_html_tocdepth.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'),
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Loading