diff options
author | Victor Stinner <vstinner@redhat.com> | 2018-11-21 12:21:25 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-11-21 12:21:25 +0100 |
commit | 7c2d5702d11b41dd9a2391e6813fbaef5dbda79a (patch) | |
tree | e15363eca65d6545988758d2f2c90a896fb47278 /Lib/test/test_c_locale_coercion.py | |
parent | d936a8f8e0964de1147656f1435532f0170f8b6c (diff) | |
download | cpython-7c2d5702d11b41dd9a2391e6813fbaef5dbda79a.tar.gz cpython-7c2d5702d11b41dd9a2391e6813fbaef5dbda79a.zip |
bpo-35290: Add debug info to test_c_locale_coercion (GH-10631)
In verbose mode, test_c_locale_coercion now dumps global variables at
startup.
Diffstat (limited to 'Lib/test/test_c_locale_coercion.py')
-rw-r--r-- | Lib/test/test_c_locale_coercion.py | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/Lib/test/test_c_locale_coercion.py b/Lib/test/test_c_locale_coercion.py index 1db293b9c37..ce8ac4eb843 100644 --- a/Lib/test/test_c_locale_coercion.py +++ b/Lib/test/test_c_locale_coercion.py @@ -8,7 +8,7 @@ import sysconfig import shutil from collections import namedtuple -import test.support +from test import support from test.support.script_helper import ( run_python_until_end, interpreter_requires_environment, @@ -27,7 +27,7 @@ EXPECT_COERCION_IN_DEFAULT_LOCALE = True # Apply some platform dependent overrides if sys.platform.startswith("linux"): - if test.support.is_android: + if support.is_android: # Android defaults to using UTF-8 for all system interfaces EXPECTED_C_LOCALE_STREAM_ENCODING = "utf-8" EXPECTED_C_LOCALE_FS_ENCODING = "utf-8" @@ -203,6 +203,15 @@ def setUpModule(): CLI_COERCION_TARGET = AVAILABLE_TARGETS[0] CLI_COERCION_WARNING = CLI_COERCION_WARNING_FMT.format(CLI_COERCION_TARGET) + if support.verbose: + print(f"AVAILABLE_TARGETS = {AVAILABLE_TARGETS!r}") + print(f"EXPECTED_C_LOCALE_EQUIVALENTS = {EXPECTED_C_LOCALE_EQUIVALENTS!r}") + print(f"EXPECTED_C_LOCALE_STREAM_ENCODING = {EXPECTED_C_LOCALE_STREAM_ENCODING!r}") + print(f"EXPECTED_C_LOCALE_FS_ENCODING = {EXPECTED_C_LOCALE_FS_ENCODING!r}") + print(f"EXPECT_COERCION_IN_DEFAULT_LOCALE = {EXPECT_COERCION_IN_DEFAULT_LOCALE!r}") + print(f"_C_UTF8_LOCALES = {_C_UTF8_LOCALES!r}") + print(f"_check_nl_langinfo_CODESET = {_check_nl_langinfo_CODESET!r}") + class _LocaleHandlingTestCase(unittest.TestCase): # Base class to check expected locale handling behaviour @@ -279,7 +288,7 @@ class LocaleConfigurationTests(_LocaleHandlingTestCase): -@test.support.cpython_only +@support.cpython_only @unittest.skipUnless(sysconfig.get_config_var("PY_COERCE_C_LOCALE"), "C locale coercion disabled at build time") class LocaleCoercionTests(_LocaleHandlingTestCase): @@ -335,7 +344,7 @@ class LocaleCoercionTests(_LocaleHandlingTestCase): # locale environment variables are undefined or empty. When # this code path is run with environ['LC_ALL'] == 'C', then # LEGACY_LOCALE_WARNING is printed. - if (test.support.is_android and + if (support.is_android and _expected_warnings == [CLI_COERCION_WARNING]): _expected_warnings = None self._check_child_encoding_details(base_var_dict, @@ -405,11 +414,11 @@ class LocaleCoercionTests(_LocaleHandlingTestCase): coercion_expected=False) def test_main(): - test.support.run_unittest( + support.run_unittest( LocaleConfigurationTests, LocaleCoercionTests ) - test.support.reap_children() + support.reap_children() if __name__ == "__main__": test_main() |