bpo-41700: Skip test if the locale is not supported (GH-22081)

This commit is contained in:
Dong-hee Na 2020-09-04 08:47:40 +00:00 committed by GitHub
parent cdbff3527c
commit 54a66ade20
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 1 deletions

View File

@ -407,7 +407,10 @@ class LocaleCoercionTests(_LocaleHandlingTestCase):
# skip the test if the LC_CTYPE locale is C or coerced # skip the test if the LC_CTYPE locale is C or coerced
old_loc = locale.setlocale(locale.LC_CTYPE, None) old_loc = locale.setlocale(locale.LC_CTYPE, None)
self.addCleanup(locale.setlocale, locale.LC_CTYPE, old_loc) self.addCleanup(locale.setlocale, locale.LC_CTYPE, old_loc)
try:
loc = locale.setlocale(locale.LC_CTYPE, "") loc = locale.setlocale(locale.LC_CTYPE, "")
except locale.Error as e:
self.skipTest(str(e))
if loc == "C": if loc == "C":
self.skipTest("test requires LC_CTYPE locale different than C") self.skipTest("test requires LC_CTYPE locale different than C")
if loc in TARGET_LOCALES : if loc in TARGET_LOCALES :