Remove mypy overrides for `tests/test_theming/test_theming.py` (#14071)

This commit is contained in:
Adam Dangoor authored and GitHub committed 2025-11-24 22:44:26 +00:00
1 parent 95b9b3e0b2
commit edd2bd370f
2 files changed
+14 -6

No files matched your search

-1
View File
@@ -243,7 +243,6 @@ module = [
"tests.test_markup.test_markup",
# tests/test_theming
"tests.test_theming.test_templating",
"tests.test_theming.test_theming",
]
disallow_untyped_defs = false
+14 -5
View File
@@ -23,6 +23,8 @@ from sphinx.theming import (
)
if TYPE_CHECKING:
from collections.abc import Callable
from sphinx.testing.util import SphinxTestApp
HERE = Path(__file__).resolve().parent
@@ -98,7 +100,7 @@ def test_theme_api(app: SphinxTestApp) -> None:
assert not any(p.exists() for p in theme._tmp_dirs)
def test_nonexistent_theme_settings(tmp_path):
def test_nonexistent_theme_settings(tmp_path: Path) -> None:
# Check that error occurs with a non-existent theme.toml or theme.conf
# https://github.com/sphinx-doc/sphinx/issues/11668
with pytest.raises(ThemeError):
@@ -150,10 +152,12 @@ def test_staticfiles(app: SphinxTestApp) -> None:
testroot='theming',
confoverrides={'html_theme': 'test-theme'},
)
def test_dark_style(app, monkeypatch):
def test_dark_style(app: SphinxTestApp, monkeypatch: pytest.MonkeyPatch) -> None:
monkeypatch.setattr(sphinx.builders.html, '_file_checksum', lambda o, f: '')
style = app.builder.dark_highlighter.formatter_args.get('style')
assert isinstance(app.builder, StandaloneHTMLBuilder)
assert app.builder.dark_highlighter is not None
style = app.builder.dark_highlighter.formatter_args['style']
assert style.__name__ == 'MonokaiStyle'
app.build()
@@ -164,7 +168,7 @@ def test_dark_style(app, monkeypatch):
assert 'media' in css_file.attributes
assert css_file.attributes['media'] == '(prefers-color-scheme: dark)'
assert sorted(f.filename for f in app.builder._css_files) == [
assert sorted(str(f.filename) for f in app.builder._css_files) == [
'_static/classic.css',
'_static/pygments.css',
'_static/pygments_dark.css',
@@ -212,7 +216,12 @@ def test_theme_sidebars(app: SphinxTestApp) -> None:
'traditional',
],
)
def test_theme_builds(make_app, rootdir, sphinx_test_tempdir, theme_name):
def test_theme_builds(
make_app: Callable[..., SphinxTestApp],
rootdir: Path,
sphinx_test_tempdir: Path,
theme_name: str,
) -> None:
"""Test all the themes included with Sphinx build a simple project and produce valid XML."""
testroot_path = rootdir / 'test-basic'
srcdir = sphinx_test_tempdir / f'test-theme-{theme_name}'