Fix text locale test issue on Windows#901
Conversation
This attempts to set the locale to the current value before changing to the testing locale to ensure that a reset will work. On failure, it skips which matches previous behaviour.
|
With the changes in this PR, the test is still being skipped. Looking into this further, it looks like this call is what is raising the enable/kiva/tests/agg/test_text.py Line 52 in 754d3f0 and it looks like there is something fundamentally wrong with the test now - |
There was a problem hiding this comment.
It looks like there are issues with locale.getlocale/locale.setlocale on windows so let's just explicitly skip the test on windows instead of indirectly skipping them in this way. Ref https://bugs.python.org/issue38324
|
Did the locale test work on anything other than mac? |
|
Possibly we should be using ("C", "ASCII")? Still doesn't work on windows. |
Hey that actually works on Python 3.8.10 and 3.6.13 - I'm not sure if it still conveys the original intent of the test though. |
|
Trying now with all skipping turned off - I think the I think it's the ASCII vs UTF-8 stuff that it's testing, rather than the language part of the setting, but it might be useful to have @rkern check that it's OK. |
|
Aha - Edit: and on mac and linux as well. |
rkern
left a comment
There was a problem hiding this comment.
LGTM. Yeah, the code being "tested" here is locale-independent by construction, so this test more records intent than anything else; it's testing that we removed the old implementation. The language is indeed an unimportant part. I think I chose C_ASCII POSIX requires it. Some Linux installations might remove en locale data.
I think I would reintroduce the try: except: around both setlocale() calls just to safeguard things for non-Windows platforms that don't have en locales. If this test fails due to one of the setlocale()s (the "given" or "cleanup" parts of the test), we should not hold up the test suite. This is a nice-to-have test, but not really critical.
This attempts to set the locale to the current value before changing to the testing locale to ensure that a reset will work. On failure, it skips which matches previous behaviour.
Fixes #899