Skip to content

bpo-35290: Add debug info to test_c_locale_coercion #10631

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 21, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 15 additions & 6 deletions Lib/test/test_c_locale_coercion.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
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,
Expand All @@ -27,7 +27,7 @@

# 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"
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -279,7 +288,7 @@ def test_external_target_locale_configuration(self):



@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):
Expand Down Expand Up @@ -335,7 +344,7 @@ def _check_c_locale_coercion(self,
# 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,
Expand Down Expand Up @@ -405,11 +414,11 @@ def test_LC_ALL_set_to_C(self):
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()