Skip to content

Commit 98a786d

Browse files
committed
Add meta-test to verify every generated locale is loadable
1 parent f908c74 commit 98a786d

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

tests/conftest.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,9 @@ def os_environ(monkeypatch):
77
mock_environ = dict(os.environ)
88
monkeypatch.setattr(os, 'environ', mock_environ)
99
return mock_environ
10+
11+
12+
def pytest_generate_tests(metafunc):
13+
if hasattr(metafunc.function, "all_locales"):
14+
from babel.localedata import locale_identifiers
15+
metafunc.parametrize("locale", list(locale_identifiers()))

tests/test_locale_load.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# -*- coding: utf-8 -*-
2+
import pytest
3+
from babel import Locale
4+
5+
6+
@pytest.mark.all_locales
7+
def test_locale_load(locale):
8+
assert str(Locale.parse(locale)) == locale

0 commit comments

Comments
 (0)