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.
This commit is contained in:
parent
a222de1a23
commit
d9ccf7fe22
@ -1231,13 +1231,14 @@ class saved_test_environment:
|
|||||||
elif os.path.isdir(support.TESTFN):
|
elif os.path.isdir(support.TESTFN):
|
||||||
shutil.rmtree(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):
|
def get_locale(self):
|
||||||
pairings = []
|
pairings = []
|
||||||
for lc in self._lc:
|
for lc in self._lc:
|
||||||
try:
|
try:
|
||||||
pairings.append((lc, locale.getlocale(lc)))
|
pairings.append((lc, locale.getlocale(lc)))
|
||||||
except TypeError:
|
except (TypeError, ValueError):
|
||||||
continue
|
continue
|
||||||
return pairings
|
return pairings
|
||||||
def restore_locale(self, saved):
|
def restore_locale(self, saved):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user