This fixes a missing .lower() on the encoding name, a wrong byte undecodable by UTF-8, a wrong variable name, hopefully some windows buildbot on 3.x and adds a proper skip. It might break other things though.
This commit is contained in:
parent
5a53fdeee8
commit
9a7d5ac9f6
|
@ -85,13 +85,14 @@ class ImportTests(unittest.TestCase):
|
||||||
# and issue never happens for dynamic modules.
|
# and issue never happens for dynamic modules.
|
||||||
# But sources modified to follow generic way for processing pathes.
|
# But sources modified to follow generic way for processing pathes.
|
||||||
|
|
||||||
locale_encoding = locale.getpreferredencoding()
|
# the return encoding can be uppercase
|
||||||
|
locale_encoding = locale.getpreferredencoding().lower()
|
||||||
|
|
||||||
# covers utf-8 and Windows ANSI code pages
|
# covers utf-8 and Windows ANSI code pages
|
||||||
# one non-space symbol from every page
|
# one non-space symbol from every page
|
||||||
# (http://en.wikipedia.org/wiki/Code_page)
|
# (http://en.wikipedia.org/wiki/Code_page)
|
||||||
known_locales = {
|
known_locales = {
|
||||||
'utf-8' : b'\xe4',
|
'utf-8' : b'\xc3\xa4',
|
||||||
'cp1250' : b'\x8C',
|
'cp1250' : b'\x8C',
|
||||||
'cp1251' : b'\xc0',
|
'cp1251' : b'\xc0',
|
||||||
'cp1252' : b'\xc0',
|
'cp1252' : b'\xc0',
|
||||||
|
@ -104,10 +105,12 @@ class ImportTests(unittest.TestCase):
|
||||||
}
|
}
|
||||||
|
|
||||||
special_char = known_locales.get(locale_encoding)
|
special_char = known_locales.get(locale_encoding)
|
||||||
if special_char:
|
if not special_char:
|
||||||
encoded_char = special_char.decode(locale_encoding)
|
self.skipTest("can't run this test with %s as preferred encoding"
|
||||||
temp_mod_name = 'test_imp_helper_' + encoded_char
|
% locale_encoding)
|
||||||
test_package_name = 'test_imp_helper_package_' + encoded_char
|
decoded_char = special_char.decode(locale_encoding)
|
||||||
|
temp_mod_name = 'test_imp_helper_' + decoded_char
|
||||||
|
test_package_name = 'test_imp_helper_package_' + decoded_char
|
||||||
init_file_name = os.path.join(test_package_name, '__init__.py')
|
init_file_name = os.path.join(test_package_name, '__init__.py')
|
||||||
try:
|
try:
|
||||||
with open(temp_mod_name + '.py', 'w') as file:
|
with open(temp_mod_name + '.py', 'w') as file:
|
||||||
|
|
Loading…
Reference in New Issue