@@ -71,13 +71,12 @@ def test_savefig_to_stringio(format, use_log, rcParams):
71
71
72
72
73
73
def test_patheffects ():
74
- with mpl .rc_context ():
75
- mpl .rcParams ['path.effects' ] = [
76
- patheffects .withStroke (linewidth = 4 , foreground = 'w' )]
77
- fig , ax = plt .subplots ()
78
- ax .plot ([1 , 2 , 3 ])
79
- with io .BytesIO () as ps :
80
- fig .savefig (ps , format = 'ps' )
74
+ mpl .rcParams ['path.effects' ] = [
75
+ patheffects .withStroke (linewidth = 4 , foreground = 'w' )]
76
+ fig , ax = plt .subplots ()
77
+ ax .plot ([1 , 2 , 3 ])
78
+ with io .BytesIO () as ps :
79
+ fig .savefig (ps , format = 'ps' )
81
80
82
81
83
82
@needs_usetex
@@ -86,18 +85,17 @@ def test_tilde_in_tempfilename(tmpdir):
86
85
# Tilde ~ in the tempdir path (e.g. TMPDIR, TMP or TEMP on windows
87
86
# when the username is very long and windows uses a short name) breaks
88
87
# latex before https://github.com/matplotlib/matplotlib/pull/5928
89
- base_tempdir = Path (str ( tmpdir ) , "short-1" )
88
+ bas
8000
e_tempdir = Path (tmpdir , "short-1" )
90
89
base_tempdir .mkdir ()
91
90
# Change the path for new tempdirs, which is used internally by the ps
92
91
# backend to write a file.
93
92
with cbook ._setattr_cm (tempfile , tempdir = str (base_tempdir )):
94
93
# usetex results in the latex call, which does not like the ~
95
- plt . rc ( 'text' , usetex = True )
94
+ mpl . rcParams [ 'text.usetex' ] = True
96
95
plt .plot ([1 , 2 , 3 , 4 ])
97
96
plt .xlabel (r'\textbf{time} (s)' )
98
- output_eps = os .path .join (str (base_tempdir ), 'tex_demo.eps' )
99
97
# use the PS backend to write the file...
100
- plt .savefig (output_eps , format = "ps" )
98
+ plt .savefig (base_tempdir / 'tex_demo.eps' , format = "ps" )
101
99
102
100
103
101
def test_source_date_epoch ():
@@ -133,11 +131,8 @@ def test_transparency():
133
131
@needs_usetex
134
132
def test_failing_latex (tmpdir ):
135
133
"""Test failing latex subprocess call"""
136
- path = str (tmpdir .join ("tmpoutput.ps" ))
137
-
138
134
mpl .rcParams ['text.usetex' ] = True
139
-
140
135
# This fails with "Double subscript"
141
136
plt .xlabel ("$22_2_2$" )
142
137
with pytest .raises (RuntimeError ):
143
- plt .savefig (path )
138
+ plt .savefig (Path ( tmpdir , "tmpoutput.ps" ) )
0 commit comments