8000 FIX: make sure addFont test removes the test font · matplotlib/matplotlib@b28e4c1 · GitHub
[go: up one dir, main page]

Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit b28e4c1

Browse files
committed
FIX: make sure addFont test removes the test font
1 parent d141366 commit b28e4c1

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

lib/matplotlib/tests/test_font_manager.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,16 @@ def test_addfont_as_path():
180180
"""Smoke test that addfont() accepts pathlib.Path."""
181181
font_test_file = 'mpltest.ttf'
182182
path = Path(__file__).parent / font_test_file
183-
fontManager.addfont(path)
183+
try:
184+
fontManager.addfont(path)
185+
added, = [font for font in fontManager.ttflist
186+
if font.fname.endswith('mpltest.ttf')]
187+
fontManager.ttflist.remove(added)
188+
finally:
189+
to_remove = [font for font in fontManager.ttflist
190+
if font.fname.endswith('mpltest.ttf')]
191+
for font in to_remove:
192+
fontManager.ttflist.remove(font)
184193

185194

186195
@pytest.mark.skipif(sys.platform != 'win32', reason='Windows only')

0 commit comments

Comments
 (0)
0