summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_locale.py
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2021-03-31 11:01:46 (GMT)
committerGitHub <noreply@github.com>2021-03-31 11:01:46 (GMT)
commitf3ab670fea75ebe177e3412a5ebe39263cd428e3 (patch)
tree45943a7d336b17ad86384b7c54c059d0cb210853 /Lib/test/test_locale.py
parent027d2cf1e5e2512888340b4cd5d2f1b5a3e8af94 (diff)
downloadcpython-f3ab670fea75ebe177e3412a5ebe39263cd428e3.zip
cpython-f3ab670fea75ebe177e3412a5ebe39263cd428e3.tar.gz
cpython-f3ab670fea75ebe177e3412a5ebe39263cd428e3.tar.bz2
bpo-37945: Fix test_locale.test_getsetlocale_issue1813() (#25110)
Skip the test if setlocale() fails.
Diffstat (limited to 'Lib/test/test_locale.py')
-rw-r--r--Lib/test/test_locale.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/Lib/test/test_locale.py b/Lib/test/test_locale.py
index bd08c4f..4bb4c55 100644
--- a/Lib/test/test_locale.py
+++ b/Lib/test/test_locale.py
@@ -564,7 +564,13 @@ class TestMiscellaneous(unittest.TestCase):
loc = locale.getlocale(locale.LC_CTYPE)
if verbose:
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))
def test_invalid_locale_format_in_localetuple(self):