Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 70285e1

Browse filesBrowse files
committed
TST: Fixed rcparams test_Issue_1713 test
1 parent c93dff4 commit 70285e1
Copy full SHA for 70285e1

File tree

Expand file treeCollapse file tree

1 file changed

+7
-7
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+7
-7
lines changed

‎lib/matplotlib/tests/test_rcparams.py

Copy file name to clipboardExpand all lines: lib/matplotlib/tests/test_rcparams.py
+7-7Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@
1010

1111
from cycler import cycler, Cycler
1212

13+
try:
14+
from unittest import mock
15+
except ImportError:
16+
import mock
1317
import matplotlib as mpl
1418
import matplotlib.pyplot as plt
1519
from matplotlib.tests import assert_str_equal
@@ -227,13 +231,9 @@ def test_legend_edgecolor():
227231
def test_Issue_1713():
228232
utf32_be = os.path.join(os.path.dirname(__file__),
229233
'test_utf32_be_rcparams.rc')
230-
old_lang = os.environ.get('LANG', None)
231-
os.environ['LANG'] = 'en_US.UTF-32-BE'
232-
rc = mpl.rc_params_from_file(utf32_be, True)
233-
if old_lang:
234-
os.environ['LANG'] = old_lang
235-
else:
236-
del os.environ['LANG']
234+
import locale
235+
with mock.patch('locale.getpreferredencoding', return_value='UTF-32-BE'):
236+
rc = mpl.rc_params_from_file(utf32_be, True, False)
237237
assert rc.get('timezone') == 'UTC'
238238

239239

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.