diff options
author | Brett Cannon <brett@python.org> | 2013-04-01 18:11:37 (GMT) |
---|---|---|
committer | Brett Cannon <brett@python.org> | 2013-04-01 18:11:37 (GMT) |
commit | 49e835bec60adfc98116480ca03afad772fa9959 (patch) | |
tree | 7bd91975e9e972b6df8fcea31f50217f499e98c6 /Lib/test/regrtest.py | |
parent | a495b498afa3ab0e2424cad0fb2fa3caacf7fd08 (diff) | |
download | cpython-49e835bec60adfc98116480ca03afad772fa9959.zip cpython-49e835bec60adfc98116480ca03afad772fa9959.tar.gz cpython-49e835bec60adfc98116480ca03afad772fa9959.tar.bz2 |
Issue #14135: Let's try this again.
Diffstat (limited to 'Lib/test/regrtest.py')
-rwxr-xr-x | Lib/test/regrtest.py | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/Lib/test/regrtest.py b/Lib/test/regrtest.py index 45b4541..4c55db5 100755 --- a/Lib/test/regrtest.py +++ b/Lib/test/regrtest.py @@ -127,6 +127,7 @@ import builtins import faulthandler import io import json +import locale import logging import os import platform @@ -1061,7 +1062,7 @@ class saved_test_environment: 'sys.warnoptions', 'threading._dangling', 'multiprocessing.process._dangling', 'sysconfig._CONFIG_VARS', 'sysconfig._INSTALL_SCHEMES', - 'support.TESTFN', + 'support.TESTFN', 'locale', ) def get_sys_argv(self): @@ -1230,6 +1231,19 @@ class saved_test_environment: elif os.path.isdir(support.TESTFN): shutil.rmtree(support.TESTFN) + _lc = [getattr(locale, lc) for lc in dir(locale) if lc.startswith('LC_')] + def get_locale(self): + pairings = [] + for lc in self._lc: + try: + pairings.append((lc, locale.getlocale(lc))) + except TypeError: + continue + return pairings + def restore_locale(self, saved): + for lc, setting in saved: + locale.setlocale(lc, setting) + def resource_info(self): for name in self.resources: method_suffix = name.replace('.', '_') |