Move mypy test module exclusions to per-module ignores (#13265)

This commit is contained in:
Adam Turner
2025-01-26 19:41:15 +00:00
committed by GitHub
parent bde37bec27
commit 7406d4222f
13 changed files with 113 additions and 94 deletions

View File

@@ -320,7 +320,7 @@ def test_autodoc_process_signature_typehints(app):
app.connect('autodoc-process-signature', process_signature)
def func(x: int, y: int) -> int:
def func(x: int, y: int) -> int: # type: ignore[empty-body]
pass
directive = make_directive_bridge(app.env)

View File

@@ -71,7 +71,7 @@ def test_cut_lines_no_objtype():
]
process = cut_lines(2)
process(None, 'function', 'func', None, {}, docstring_lines) # type: ignore[arg-type]
process(None, 'function', 'func', None, {}, docstring_lines)
assert docstring_lines == [
'second line',
'---',

View File

@@ -240,7 +240,7 @@ def test_escaping(app):
@pytest.mark.sphinx('html', testroot='ext-autosummary')
def test_autosummary_generate_content_for_module(app):
import autosummary_dummy_module
import autosummary_dummy_module # type: ignore[import-not-found]
template = Mock()
@@ -457,7 +457,7 @@ def test_autosummary_generate_content_for_module_imported_members(app):
@pytest.mark.sphinx('html', testroot='ext-autosummary')
def test_autosummary_generate_content_for_module_imported_members_inherited_module(app):
import autosummary_dummy_inherited_module
import autosummary_dummy_inherited_module # type: ignore[import-not-found]
template = Mock()

View File

@@ -75,7 +75,7 @@ def cleanup_call():
cleanup_called += 1
recorded_calls = Counter()
recorded_calls: Counter[tuple[str, str, int]] = Counter()
@pytest.mark.sphinx('doctest', testroot='ext-doctest-skipif')

View File

@@ -327,7 +327,7 @@ def test_import_classes(rootdir):
saved_path = sys.path.copy()
sys.path.insert(0, str(rootdir / 'test-ext-inheritance_diagram'))
try:
from example.sphinx import DummyClass
from example.sphinx import DummyClass # type: ignore[import-not-found]
# got exception for unknown class or module
with pytest.raises(InheritanceException):

View File

@@ -38,7 +38,7 @@ from tests.test_util.intersphinx_data import (
from tests.utils import http_server
class FakeList(list): # NoQA: FURB189
class FakeList(list[str]):
def __iter__(self) -> NoReturn:
raise NotImplementedError