diff --git a/lib/matplotlib/tests/test_backend_pdf.py b/lib/matplotlib/tests/test_backend_pdf.py index 8f17176dac53..1d9b7b0ed12f 100644 --- a/lib/matplotlib/tests/test_backend_pdf.py +++ b/lib/matplotlib/tests/test_backend_pdf.py @@ -6,6 +6,9 @@ @image_comparison(baseline_images=['pdf_use14corefonts'], extensions=['pdf']) def test_use14corefonts(): + original_rcParams = {} + original_rcParams.update(rcParams) + rcParams['backend'] = 'pdf' rcParams['pdf.use14corefonts'] = True rcParams['font.family'] = 'sans-serif' @@ -18,8 +21,11 @@ def test_use14corefonts(): and containing some French characters and the euro symbol: "Merci pépé pour les 10 €"''' - plt.figure() - plt.title(title) - plt.text(0.5, 0.5, text, horizontalalignment='center', fontsize=24) - plt.axhline(0.5, linewidth=0.5) - plt.savefig('pdf_use14corefonts.pdf') + try: + plt.figure() + plt.title(title) + plt.text(0.5, 0.5, text, horizontalalignment='center', fontsize=24) + plt.axhline(0.5, linewidth=0.5) + plt.savefig('pdf_use14corefonts.pdf') + finally: + rcParams.update(original_rcParams)