mirror of
https://github.com/python/cpython.git
synced 2025-09-26 18:29:57 +00:00
bpo-37945: Fix test_locale.test_getsetlocale_issue1813() (#25110)
Skip the test if setlocale() fails.
This commit is contained in:
parent
027d2cf1e5
commit
f3ab670fea
2 changed files with 9 additions and 1 deletions
|
@ -564,7 +564,13 @@ class TestMiscellaneous(unittest.TestCase):
|
||||||
loc = locale.getlocale(locale.LC_CTYPE)
|
loc = locale.getlocale(locale.LC_CTYPE)
|
||||||
if verbose:
|
if verbose:
|
||||||
print('testing with %a' % (loc,), end=' ', flush=True)
|
print('testing with %a' % (loc,), end=' ', flush=True)
|
||||||
locale.setlocale(locale.LC_CTYPE, loc)
|
try:
|
||||||
|
locale.setlocale(locale.LC_CTYPE, loc)
|
||||||
|
except locale.Error as exc:
|
||||||
|
# bpo-37945: setlocale(LC_CTYPE) fails with getlocale(LC_CTYPE)
|
||||||
|
# and the tr_TR locale on Windows. getlocale() builds a locale
|
||||||
|
# which is not recognize by setlocale().
|
||||||
|
self.skipTest(f"setlocale(LC_CTYPE, {loc!r}) failed: {exc!r}")
|
||||||
self.assertEqual(loc, locale.getlocale(locale.LC_CTYPE))
|
self.assertEqual(loc, locale.getlocale(locale.LC_CTYPE))
|
||||||
|
|
||||||
def test_invalid_locale_format_in_localetuple(self):
|
def test_invalid_locale_format_in_localetuple(self):
|
||||||
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
Fix test_getsetlocale_issue1813() of test_locale: skip the test if
|
||||||
|
``setlocale()`` fails. Patch by Victor Stinner.
|
Loading…
Add table
Add a link
Reference in a new issue