Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 303d361

Browse files
committed
Merged pull request #95 from mdboom/backend_pdf_test_side_effect_bug.
Fix backend_pdf test
2 parents 2582320 + 462cbf8 commit 303d361

1 file changed

Lines changed: 11 additions & 5 deletions

File tree

lib/matplotlib/tests/test_backend_pdf.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66

77
@image_comparison(baseline_images=['pdf_use14corefonts'], extensions=['pdf'])
88
def test_use14corefonts():
9+
original_rcParams = {}
10+
original_rcParams.update(rcParams)
11+
912
rcParams['backend'] = 'pdf'
1013
rcParams['pdf.use14corefonts'] = True
1114
rcParams['font.family'] = 'sans-serif'
@@ -18,8 +21,11 @@ def test_use14corefonts():
1821
and containing some French characters and the euro symbol:
1922
"Merci pépé pour les 10 €"'''
2023

21-
plt.figure()
22-
plt.title(title)
23-
plt.text(0.5, 0.5, text, horizontalalignment='center', fontsize=24)
24-
plt.axhline(0.5, linewidth=0.5)
25-
plt.savefig('pdf_use14corefonts.pdf')
24+
try:
25+
plt.figure()
26+
plt.title(title)
27+
plt.text(0.5, 0.5, text, horizontalalignment='center', fontsize=24)
28+
plt.axhline(0.5, linewidth=0.5)
29+
plt.savefig('pdf_use14corefonts.pdf')
30+
finally:
31+
rcParams.update(original_rcParams)

0 commit comments

Comments
 (0)