mirror of
https://github.com/python/cpython.git
synced 2025-12-08 06:10:17 +00:00
Skip unsupported locales
This commit is contained in:
parent
ff7d10a36a
commit
307c7f33d0
1 changed files with 6 additions and 3 deletions
|
|
@ -771,10 +771,10 @@ def test_encoding_not_ignored(self, patch_expand_lang):
|
||||||
|
|
||||||
def test_find_LANGUAGE_priority(self):
|
def test_find_LANGUAGE_priority(self):
|
||||||
self.env.set('LANGUAGE', 'ga_IE')
|
self.env.set('LANGUAGE', 'ga_IE')
|
||||||
self.env.set('LC_ALL', 'pt_BR')
|
self.env.set('LC_ALL', 'C')
|
||||||
orig = locale.setlocale(locale.LC_ALL)
|
orig = locale.setlocale(locale.LC_ALL)
|
||||||
self.addCleanup(lambda: locale.setlocale(locale.LC_ALL, orig))
|
self.addCleanup(lambda: locale.setlocale(locale.LC_ALL, orig))
|
||||||
locale.setlocale(locale.LC_ALL, 'pt_BR')
|
locale.setlocale(locale.LC_ALL, 'C')
|
||||||
mo_file = self.create_mo_file("ga_IE")
|
mo_file = self.create_mo_file("ga_IE")
|
||||||
result = gettext.find("mofile", localedir=os.path.join(self.tempdir, "locale"))
|
result = gettext.find("mofile", localedir=os.path.join(self.tempdir, "locale"))
|
||||||
self.assertEqual(result, mo_file)
|
self.assertEqual(result, mo_file)
|
||||||
|
|
@ -784,7 +784,10 @@ def test_process_vars_override(self):
|
||||||
self.addCleanup(lambda: locale.setlocale(locale.LC_ALL, orig))
|
self.addCleanup(lambda: locale.setlocale(locale.LC_ALL, orig))
|
||||||
mo_file = self.create_mo_file("ca_ES")
|
mo_file = self.create_mo_file("ca_ES")
|
||||||
for loc in ("ca_ES", "ca_ES.UTF-8", "ca_ES@euro", "ca_ES@valencia"):
|
for loc in ("ca_ES", "ca_ES.UTF-8", "ca_ES@euro", "ca_ES@valencia"):
|
||||||
|
try:
|
||||||
locale.setlocale(locale.LC_ALL, loc)
|
locale.setlocale(locale.LC_ALL, loc)
|
||||||
|
except locale.Error:
|
||||||
|
self.skipTest('platform does not support locale')
|
||||||
result = gettext.find("mofile", localedir=os.path.join(self.tempdir, "locale"))
|
result = gettext.find("mofile", localedir=os.path.join(self.tempdir, "locale"))
|
||||||
self.assertEqual(mo_file, result)
|
self.assertEqual(mo_file, result)
|
||||||
for loc in ("C", "C.UTF-8"):
|
for loc in ("C", "C.UTF-8"):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue