diff --git a/lib/matplotlib/tests/test_font_manager.py b/lib/matplotlib/tests/test_font_manager.py index 19e9c9f2a4e1..637ffa79b443 100644 --- a/lib/matplotlib/tests/test_font_manager.py +++ b/lib/matplotlib/tests/test_font_manager.py @@ -4,6 +4,7 @@ from nose.tools import assert_equal from matplotlib.externals import six +import sys import os import tempfile import warnings @@ -24,8 +25,14 @@ def test_font_priority(): def test_json_serialization(): with tempfile.NamedTemporaryFile() as temp: + if sys.platform == 'win32': + # on Windows, an open NamedTemporaryFile can not be used + # to open the file a second time + temp.close() json_dump(fontManager, temp.name) copy = json_load(temp.name) + if sys.platform == 'win32': + os.remove(temp.name) with warnings.catch_warnings(): warnings.filterwarnings('ignore', 'findfont: Font family.*not found') for prop in ({'family': 'STIXGeneral'},