pandas-dev / pandas

Flexible and powerful data analysis / manipulation library for Python, providing labeled data structures similar to R data.frame objects, statistical functions, and much more
https://pandas.pydata.org
BSD 3-Clause "New" or "Revised" License
43.8k stars 17.98k forks source link

Make test_localization tests execute on windows targets #46597

Open smarie opened 2 years ago

smarie commented 2 years ago

EDIT: See next post, this original issue about the get_locale returning an empty list on windows, has been extended to a broader one.

Reproducible Example

On a windows platform

from pandas._config.localization import get_locales

print(type(get_locales()))  # NoneType

Issue Description

On windows machines locale -a does not exist and therefore get_locales() returns None

This may be an issue for locale-related test coverage on windows CI runners, because @_skip_if_only_one_locale is always True.

I discovered this when I tried to execute test_set_locale on my machine and found out that it was not executing at all (all skipped!)

Expected Behavior

A list of locale available should be returned. The solution might not be easy to find however :( See https://stackoverflow.com/questions/19709026/how-can-i-list-all-available-windows-locales-in-python-console

Workaround: I think that we can avoid fixing this, if we change @_skip_if_only_one_locale so that on windows runners it is less strict.

Installed Versions

Replace this line with the output of pd.show_versions()
smarie commented 2 years ago

Oh I see that even when commenting out the decorator, the whole test_localization module is marked as skipped still.

pytestmark = pytest.mark.skipif(
    is_platform_windows() or not _all_locales, reason="Need non-Windows and locales"
)

So nevermind, the issue is broader and could be renamed "Make test_localization tests execute on windows targets"