Index: Lib/test/test__locale.py =================================================================== --- Lib/test/test__locale.py (revision 72194) +++ Lib/test/test__locale.py (working copy) @@ -1,6 +1,12 @@ from test.support import verbose, run_unittest -from _locale import (setlocale, LC_ALL, LC_CTYPE, LC_NUMERIC, RADIXCHAR, THOUSEP, nl_langinfo, - localeconv, Error) +from _locale import (setlocale, LC_ALL, LC_CTYPE, LC_NUMERIC, localeconv, Error) +try: + from _locale import (RADIXCHAR, THOUSEP, nl_langinfo) +except ImportError: + can_use_nl_langinfo = False +else: + can_use_nl_langinfo = True + import unittest from platform import uname @@ -53,6 +59,7 @@ calc_type, data_type, set_locale, used_locale)) + @unittest.skipUnless(can_use_nl_langinfo, "nl_langinfo is not available") def test_lc_numeric_nl_langinfo(self): # Test nl_langinfo against known values for loc in candidate_locales: @@ -73,10 +80,11 @@ setlocale(LC_CTYPE, loc) except Error: continue - for li, lc in ((RADIXCHAR, "decimal_point"), - (THOUSEP, "thousands_sep")): + for lc in ("decimal_point", + "thousands_sep"): self.numeric_tester('localeconv', localeconv()[lc], lc, loc) + @unittest.skipUnless(can_use_nl_langinfo, "nl_langinfo is not available") def test_lc_numeric_basic(self): # Test nl_langinfo against localeconv for loc in candidate_locales: