[Python-checkins] cpython: Issue #18228: Fix locale test of test.regrtest.saved_test_environment

victor.stinner python-checkins at python.org
Mon Jun 17 20:40:21 CEST 2013


http://hg.python.org/cpython/rev/00824f9e29f3
changeset:   84191:00824f9e29f3
user:        Victor Stinner <victor.stinner at gmail.com>
date:        Mon Jun 17 20:40:05 2013 +0200
summary:
  Issue #18228: Fix locale test of test.regrtest.saved_test_environment

Skip LC_ALL becore getlocale(locale.LC_ALL) always fail, and catch also
ValueError.

files:
  Lib/test/regrtest.py |  5 +++--
  1 files changed, 3 insertions(+), 2 deletions(-)


diff --git a/Lib/test/regrtest.py b/Lib/test/regrtest.py
--- a/Lib/test/regrtest.py
+++ b/Lib/test/regrtest.py
@@ -1231,13 +1231,14 @@
             elif os.path.isdir(support.TESTFN):
                 shutil.rmtree(support.TESTFN)
 
-    _lc = [getattr(locale, lc) for lc in dir(locale) if lc.startswith('LC_')]
+    _lc = [getattr(locale, lc) for lc in dir(locale)
+           if lc.startswith('LC_') and lc != 'LC_ALL']
     def get_locale(self):
         pairings = []
         for lc in self._lc:
             try:
                 pairings.append((lc, locale.getlocale(lc)))
-            except TypeError:
+            except (TypeError, ValueError):
                 continue
         return pairings
     def restore_locale(self, saved):

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list