Skip to content

Commit 4bdae6b

Browse files
committed
Be more careful about setting the locale
1 parent 637a565 commit 4bdae6b

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

lib/matplotlib/tests/__init__.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,17 @@ def setup():
1111
# The baseline images are created in this locale, so we should use
1212
# it during all of the tests.
1313
import locale
14-
locale.setlocale(locale.LC_ALL, str('en_US.UTF-8'))
14+
import warnings
15+
16+
try:
17+
locale.setlocale(locale.LC_ALL, str('en_US.UTF-8'))
18+
except:
19+
try:
20+
locale.setlocale(locale.LC_ALL, str('English_United States.1252'))
21+
except:
22+
warnings.warn(
23+
"Could not set locale to English/United States. "
24+
"Some date-related tests may fail")
1525

1626
use('Agg', warn=False) # use Agg backend for these tests
1727

0 commit comments

Comments
 (0)