@@ -71,13 +71,12 @@ def test_savefig_to_stringio(format, use_log, rcParams):
7171
7272
7373def 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' )
8180
8281
8382@needs_usetex
@@ -86,18 +85,17 @@ def test_tilde_in_tempfilename(tmpdir):
8685 # Tilde ~ in the tempdir path (e.g. TMPDIR, TMP or TEMP on windows
8786 # when the username is very long and windows uses a short name) breaks
8887 # latex before https://github.com/matplotlib/matplotlib/pull/5928
89- base_tempdir = Path (str ( tmpdir ) , "short-1" )
88+ base_tempdir = Path (tmpdir , "short-1" )
9089 base_tempdir .mkdir ()
9190 # Change the path for new tempdirs, which is used internally by the ps
9291 # backend to write a file.
9392 with cbook ._setattr_cm (tempfile , tempdir = str (base_tempdir )):
9493 # usetex results in the latex call, which does not like the ~
95- plt . rc ( 'text' , usetex = True )
94+ mpl . rcParams [ 'text.usetex' ] = True
9695 plt .plot ([1 , 2 , 3 , 4 ])
9796 plt .xlabel (r'\textbf{time} (s)' )
98- output_eps = os .path .join (str (base_tempdir ), 'tex_demo.eps' )
9997 # 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" )
10199
102100
103101def test_source_date_epoch ():
@@ -133,11 +131,8 @@ def test_transparency():
133131@needs_usetex
134132def test_failing_latex (tmpdir ):
135133 """Test failing latex subprocess call"""
136- path = str (tmpdir .join ("tmpoutput.ps" ))
137-
138134 mpl .rcParams ['text.usetex' ] = True
139-
140135 # This fails with "Double subscript"
141136 plt .xlabel ("$22_2_2$" )
142137 with pytest .raises (RuntimeError ):
143- plt .savefig (path )
138+ plt .savefig (Path ( tmpdir , "tmpoutput.ps" ) )
0 commit comments