File tree Expand file tree Collapse file tree 1 file changed +7
-7
lines changed Expand file tree Collapse file tree 1 file changed +7
-7
lines changed Original file line number Diff line number Diff line change 10
10
11
11
from cycler import cycler , Cycler
12
12
13
+ try :
14
+ from unittest import mock
15
+ except ImportError :
16
+ import mock
13
17
import matplotlib as mpl
14
18
import matplotlib .pyplot as plt
15
19
from matplotlib .tests import assert_str_equal
@@ -212,13 +216,9 @@ def test_legend_edgecolor():
212
216
def test_Issue_1713 ():
213
217
utf32_be = os .path .join (os .path .dirname (__file__ ),
214
218
'test_utf32_be_rcparams.rc' )
215
- old_lang = os .environ .get ('LANG' , None )
216
- os .environ ['LANG' ] = 'en_US.UTF-32-BE'
217
- rc = mpl .rc_params_from_file (utf32_be , True )
218
- if old_lang :
219
- os .environ ['LANG' ] = old_lang
220
- else :
221
- del os .environ ['LANG' ]
219
+ import locale
220
+ with mock .patch ('locale.getpreferredencoding' , return_value = 'UTF-32-BE' ):
221
+ rc = mpl .rc_params_from_file (utf32_be , True , False )
222
222
assert rc .get ('timezone' ) == 'UTC'
223
223
224
224
You can’t perform that action at this time.
0 commit comments