Commit 404b0681 authored by Johannes Gijsbers's avatar Johannes Gijsbers

Reset old locale after running tests. Not doing so broke

test_format/test_unicode in some circumstances (patch #1007539/bug #992078).
parent 7c399d3e
...@@ -13,22 +13,26 @@ candidate_locales = ['es_UY', 'fr_FR', 'fi_FI', 'es_CO', 'pt_PT', 'it_IT', ...@@ -13,22 +13,26 @@ candidate_locales = ['es_UY', 'fr_FR', 'fi_FI', 'es_CO', 'pt_PT', 'it_IT',
'eu_ES', 'vi_VN', 'af_ZA', 'nb_NO', 'en_DK', 'tg_TJ', 'eu_ES', 'vi_VN', 'af_ZA', 'nb_NO', 'en_DK', 'tg_TJ',
'es_ES.ISO8859-1', 'fr_FR.ISO8859-15', 'ru_RU.KOI8-R', 'ko_KR.eucKR'] 'es_ES.ISO8859-1', 'fr_FR.ISO8859-15', 'ru_RU.KOI8-R', 'ko_KR.eucKR']
saw_locale = 0 oldlocale = setlocale(LC_NUMERIC)
for loc in candidate_locales: try:
try: saw_locale = 0
setlocale(LC_NUMERIC, loc) for loc in candidate_locales:
except Error: try:
continue setlocale(LC_NUMERIC, loc)
if verbose: except Error:
print "locale %r" % loc continue
saw_locale = 1 if verbose:
nl_radixchar = nl_langinfo(RADIXCHAR) print "locale %r" % loc
li_radixchar = localeconv()['decimal_point'] saw_locale = 1
if nl_radixchar != li_radixchar: nl_radixchar = nl_langinfo(RADIXCHAR)
print "%r != %r" % (nl_radixchar, li_radixchar) li_radixchar = localeconv()['decimal_point']
nl_radixchar = nl_langinfo(THOUSEP) if nl_radixchar != li_radixchar:
li_radixchar = localeconv()['thousands_sep'] print "%r != %r" % (nl_radixchar, li_radixchar)
if nl_radixchar != li_radixchar: nl_radixchar = nl_langinfo(THOUSEP)
print "%r != %r" % (nl_radixchar, li_radixchar) li_radixchar = localeconv()['thousands_sep']
if not saw_locale: if nl_radixchar != li_radixchar:
raise ImportError, "None of the listed locales found" print "%r != %r" % (nl_radixchar, li_radixchar)
if not saw_locale:
raise ImportError, "None of the listed locales found"
finally:
setlocale(LC_NUMERIC, oldlocale)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment