From 462cbf8c8e7321757a1a8db010e9a9ad7c617e39 Mon Sep 17 00:00:00 2001 From: Michael Droettboom Date: Tue, 26 Apr 2011 12:28:12 -0400 Subject: [PATCH] The backend_pdf test had a side effect that was causing subsequent tests to fail. --- lib/matplotlib/tests/test_backend_pdf.py | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) 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)