Skip to content

Commit f25cfdd

Browse files
Remove mypy overrides for tests/test_intl/test_locale.py (#13764)
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
1 parent e094ae3 commit f25cfdd

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

pyproject.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,6 @@ module = [
274274
"tests.test_extensions.test_ext_viewcode",
275275
# tests/test_intl
276276
"tests.test_intl.test_catalogs",
277-
"tests.test_intl.test_locale",
278277
# tests/test_markup
279278
"tests.test_markup.test_markup",
280279
"tests.test_markup.test_parser",

tests/test_intl/test_locale.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,19 @@
99
from sphinx import locale
1010

1111
if TYPE_CHECKING:
12-
from collections.abc import Callable
12+
from collections.abc import Callable, Iterator
1313
from pathlib import Path
1414

15+
from sphinx.testing.util import SphinxTestApp
16+
1517

1618
@pytest.fixture(autouse=True)
17-
def _cleanup_translations():
19+
def _cleanup_translations() -> Iterator[None]:
1820
yield
1921
locale.translators.clear()
2022

2123

22-
def test_init(rootdir):
24+
def test_init(rootdir: Path) -> None:
2325
# not initialized yet
2426
_ = locale.get_translation('myext')
2527
assert _('Hello world') == 'Hello world'
@@ -48,7 +50,7 @@ def test_init(rootdir):
4850
assert _('Hello reST') == 'Hello reST'
4951

5052

51-
def test_init_with_unknown_language(rootdir):
53+
def test_init_with_unknown_language(rootdir: Path) -> None:
5254
locale.init([rootdir / 'test-locale' / 'locale1'], 'unknown', 'myext')
5355
_ = locale.get_translation('myext')
5456
assert _('Hello world') == 'Hello world'
@@ -57,7 +59,7 @@ def test_init_with_unknown_language(rootdir):
5759

5860

5961
@pytest.mark.sphinx('html', testroot='root')
60-
def test_add_message_catalog(app, rootdir):
62+
def test_add_message_catalog(app: SphinxTestApp, rootdir: Path) -> None:
6163
app.config.language = 'en'
6264
app.add_message_catalog('myext', rootdir / 'test-locale' / 'locale1')
6365
_ = locale.get_translation('myext')
@@ -73,7 +75,9 @@ def _empty_language_translation(rootdir: Path) -> Callable[[str], str]:
7375
return locale.get_translation(catalog)
7476

7577

76-
def test_init_environment_language(rootdir, monkeypatch):
78+
def test_init_environment_language(
79+
rootdir: Path, monkeypatch: pytest.MonkeyPatch
80+
) -> None:
7781
with monkeypatch.context() as m:
7882
m.setenv('LANGUAGE', 'en_US:en')
7983
_ = _empty_language_translation(rootdir)

0 commit comments

Comments
 (0)