@@ -117,30 +117,26 @@ def test_pdflatex():
117117@pytest .mark .style ('default' )
118118@pytest .mark .backend ('pgf' )
119119def test_rcupdate ():
120- rc_sets = []
121- rc_sets .append ({'font.family' : 'sans-serif' ,
122- 'font.size' : 30 ,
123- 'figure.subplot.left' : .2 ,
124- 'lines.markersize' : 10 ,
125- 'pgf.rcfonts' : False ,
126- 'pgf.texsystem' : 'xelatex' })
127- rc_sets .append ({'font.family' : 'monospace' ,
128- 'font.size' : 10 ,
129- 'figure.subplot.left' : .1 ,
130- 'lines.markersize' : 20 ,
131- 'pgf.rcfonts' : False ,
132- 'pgf.texsystem' : 'pdflatex' ,
133- 'pgf.preamble' : ['\\ usepackage[utf8x]{inputenc}' ,
134- '\\ usepackage[T1]{fontenc}' ,
135- '\\ usepackage{sfmath}' ]})
136- tol = (6 , 0 )
137- original_params = mpl .rcParams .copy ()
120+ rc_sets = [{'font.family' : 'sans-serif' ,
121+ 'font.size' : 30 ,
122+ 'figure.subplot.left' : .2 ,
123+ 'lines.markersize' : 10 ,
124+ 'pgf.rcfonts' : False ,
125+ 'pgf.texsystem' : 'xelatex' },
126+ {'font.family' : 'monospace' ,
127+ 'font.size' : 10 ,
128+ 'figure.subplot.left' : .1 ,
129+ 'lines.markersize' : 20 ,
130+ 'pgf.rcfonts' : False ,
131+ 'pgf.texsystem' : 'pdflatex' ,
132+ 'pgf.preamble' : ['\\ usepackage[utf8x]{inputenc}' ,
133+ '\\ usepackage[T1]{fontenc}' ,
134+ '\\ usepackage{sfmath}' ]}]
135+ tol = [6 , 0 ]
138136 for i , rc_set in enumerate (rc_sets ):
139- mpl .rcParams .clear ()
140- mpl .rcParams .update (original_params )
141- mpl .rcParams .update (rc_set )
142- create_figure ()
143- compare_figure ('pgf_rcupdate%d.pdf' % (i + 1 ), tol = tol [i ])
137+ with mpl .rc_context (rc_set ):
138+ create_figure ()
139+ compare_figure ('pgf_rcupdate%d.pdf' % (i + 1 ), tol = tol [i ])
144140
145141
146142# test backend-side clipping, since large numbers are not supported by TeX
0 commit comments