|
15 | 15 | # Set the list of ways we expect to be able to ask for the "C" locale. |
16 | 16 | # 'invalid.ascii' is an invalid LOCALE name and so should get turned in to the |
17 | 17 | # default locale, which is traditionally C. |
18 | | -EXPECTED_C_LOCALE_EQUIVALENTS = ["C", "invalid.ascii"] |
| 18 | +EXPECTED_C_LOCALE_EQUIVALENTS = ["C", "POSIX", "invalid.ascii"] |
19 | 19 |
|
20 | 20 | # Set our expectation for the default encoding used in the C locale |
21 | 21 | # for the filesystem encoding and the standard streams |
|
55 | 55 | # VxWorks defaults to using UTF-8 for all system interfaces |
56 | 56 | EXPECTED_C_LOCALE_STREAM_ENCODING = "utf-8" |
57 | 57 | EXPECTED_C_LOCALE_FS_ENCODING = "utf-8" |
58 | | -if sys.platform.startswith("linux"): |
59 | | - # Linux recognizes POSIX as a synonym for C. Python will always coerce |
60 | | - # if the locale is set to POSIX, but not all platforms will use the |
61 | | - # C locale encodings if POSIX is set, so we'll only test it on linux. |
62 | | - EXPECTED_C_LOCALE_EQUIVALENTS.append("POSIX") |
63 | 58 |
|
64 | 59 | # Note that the above expectations are still wrong in some cases, such as: |
65 | 60 | # * Windows when PYTHONLEGACYWINDOWSFSENCODING is set |
@@ -467,8 +462,9 @@ def test_PYTHONCOERCECLOCALE_set_to_one(self): |
467 | 462 | loc = locale.setlocale(locale.LC_CTYPE, "") |
468 | 463 | except locale.Error as e: |
469 | 464 | self.skipTest(str(e)) |
470 | | - if loc == "C": |
471 | | - self.skipTest("test requires LC_CTYPE locale different than C") |
| 465 | + if loc in ("C", "POSIX"): |
| 466 | + self.skipTest("test requires LC_CTYPE locale different " |
| 467 | + "than C and POSIX") |
472 | 468 | if loc in TARGET_LOCALES : |
473 | 469 | self.skipTest("coerced LC_CTYPE locale: %s" % loc) |
474 | 470 |
|
|
0 commit comments