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

Skip to content

Commit 123450e

Browse files
committed
Merge pull request matplotlib#3317 from cgohlke/patch-1
TST: Fix test_animation RuntimeErrors on Windows This does not require another RC
2 parents 1787fb1 + ca893ef commit 123450e

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

lib/matplotlib/tests/test_animation.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
import six
55

6+
import os
67
import tempfile
78
import sys
89
import numpy as np
@@ -55,6 +56,7 @@ def animate(i):
5556

5657
# Use NamedTemporaryFile: will be automatically deleted
5758
F = tempfile.NamedTemporaryFile(suffix='.' + extension)
59+
F.close()
5860
anim = animation.FuncAnimation(fig, animate, init_func=init, frames=5)
5961
try:
6062
anim.save(F.name, fps=30, writer=writer)
@@ -63,7 +65,10 @@ def animate(i):
6365
"import stack, " +
6466
"see issues #1891 and #2679")
6567
finally:
66-
F.close()
68+
try:
69+
os.remove(F.name)
70+
except Exception:
71+
pass
6772

6873

6974
@cleanup

0 commit comments

Comments
 (0)