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

Skip to content

Commit 1179df7

Browse files
committed
TST: workaround for windows
1 parent 52a198e commit 1179df7

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

lib/matplotlib/tests/test_font_manager.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,13 @@ def test_font_priority():
2929

3030

3131
def test_json_serialization():
32-
with tempfile.NamedTemporaryFile() as temp:
33-
json_dump(fontManager, temp.name)
34-
copy = json_load(temp.name)
32+
# on windows, we can't open a file twice, so save the name and unlink
33+
# manually...
34+
with tempfile.NamedTemporaryFile(delete=False) as temp:
35+
name = temp.name
36+
json_dump(fontManager, name)
37+
copy = json_load(name)
38+
os.remove(name)
3539
with warnings.catch_warnings():
3640
warnings.filterwarnings('ignore', 'findfont: Font family.*not found')
3741
for prop in ({'family': 'STIXGeneral'},

0 commit comments

Comments
 (0)