@@ -26,7 +26,8 @@ def temp_style(style_name, settings=None):
2626 with TemporaryDirectory () as tmpdir :
2727 # Write style settings to file in the tmpdir.
2828 Path (tmpdir , temp_file ).write_text (
29- "\n " .join ("{}: {}" .format (k , v ) for k , v in settings .items ()))
29+ "\n " .join ("{}: {}" .format (k , v ) for k , v in settings .items ()),
30+ encoding = "utf-8" )
3031 # Add tmpdir to style path and reload so we can access this style.
3132 USER_LIBRARY_PATHS .append (tmpdir )
3233 style .reload_library ()
@@ -59,7 +60,7 @@ def test_use():
5960
6061def test_use_url (tmpdir ):
6162 path = Path (tmpdir , 'file' )
62- path .write_text ('axes.facecolor: adeade' )
63+ path .write_text ('axes.facecolor: adeade' , encoding = 'utf-8' )
6364 with temp_style ('test' , DUMMY_SETTINGS ):
6465 url = ('file:'
6566 + ('///' if sys .platform == 'win32' else '' )
@@ -72,7 +73,7 @@ def test_single_path(tmpdir):
7273 mpl .rcParams [PARAM ] = 'gray'
7374 temp_file = f'text.{ STYLE_EXTENSION } '
7475 path = Path (tmpdir , temp_file )
75- path .write_text (f'{ PARAM } : { VALUE } ' )
76+ path .write_text (f'{ PARAM } : { VALUE } ' , encoding = 'utf-8' )
7677 with style .context (path ):
7778 assert mpl .rcParams [PARAM ] == VALUE
7879 assert mpl .rcParams [PARAM ] == 'gray'
0 commit comments