[Python-checkins] bpo-41700: Skip test if the locale is not supported (GH-22081) (GH-22086)

Miss Islington (bot) webhook-mailer at python.org
Fri Sep 4 05:55:50 EDT 2020

commit: 4bcff52447b472bc5c8698d4ab29c09df9e122b4
branch: 3.8
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: GitHub <noreply at github.com>
date: 2020-09-04T18:55:44+09:00

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

(cherry picked from commit 54a66ade2067c373d31003ad260e1b7d14c81564)

Co-authored-by: Dong-hee Na <donghee.na92 at gmail.com>

Co-authored-by: Dong-hee Na <donghee.na92 at gmail.com>

M Lib/test/test_c_locale_coercion.py

diff --git a/Lib/test/test_c_locale_coercion.py b/Lib/test/test_c_locale_coercion.py
index fb599b0fcb7a5..418f9b6154b53 100644
--- a/Lib/test/test_c_locale_coercion.py
+++ b/Lib/test/test_c_locale_coercion.py
@@ -403,7 +403,10 @@ def test_PYTHONCOERCECLOCALE_set_to_one(self):
         # skip the test if the LC_CTYPE locale is C or coerced
         old_loc = locale.setlocale(locale.LC_CTYPE, None)
         self.addCleanup(locale.setlocale, locale.LC_CTYPE, old_loc)
-        loc = locale.setlocale(locale.LC_CTYPE, "")
+        try:
+            loc = locale.setlocale(locale.LC_CTYPE, "")
+        except locale.Error as e:
+            self.skipTest(str(e))
         if loc == "C":
             self.skipTest("test requires LC_CTYPE locale different than C")
         if loc in TARGET_LOCALES :

More information about the Python-checkins mailing list