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 1341ad5

Browse filesBrowse files
authored
Merge pull request #23342 from tacaswell/fix/font_list
FIX: make sure addFont test removes the test font
2 parents dff87ce + 6b901fe commit 1341ad5
Copy full SHA for 1341ad5

File tree

Expand file treeCollapse file tree

1 file changed

+10
-1
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+10
-1
lines changed

‎lib/matplotlib/tests/test_font_manager.py

Copy file name to clipboardExpand all lines: lib/matplotlib/tests/test_font_manager.py
+10-1Lines 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(font_test_file)]
187+
fontManager.ttflist.remove(added)
188+
finally:
189+
to_remove = [font for font in fontManager.ttflist
190+
if font.fname.endswith(font_test_file)]
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)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.