Skip to content

Commit a1f3773

Browse files
author
Sylvain MARIE
committed
Fixed test_localization so that pandas-dev#46595 can be demonstrated on windows targets (even if today these do not run on windows targets, see pandas-dev#46597)
1 parent 0105ac9 commit a1f3773

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

pandas/tests/config/test_localization.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
import pandas as pd
1616

1717
_all_locales = get_locales() or []
18-
_current_locale = locale.getlocale()
18+
_current_locale = locale.setlocale(locale.LC_ALL) # getlocale() is wrong, see GH#46595
1919

2020
# Don't run any of these tests if we are on Windows or have no locales.
2121
pytestmark = pytest.mark.skipif(
@@ -95,7 +95,8 @@ def test_set_locale(lang, enc):
9595
assert normalized_locale == new_locale
9696

9797
# Once we exit the "with" statement, locale should be back to what it was.
98-
current_locale = locale.getlocale()
98+
# current_locale = locale.getlocale() is wrong, see GH#46595
99+
current_locale = locale.setlocale(locale.LC_ALL)
99100
assert current_locale == _current_locale
100101

101102

0 commit comments

Comments
 (0)