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

Skip to content

Commit 2c85848

Browse files
committed
Merge pull request matplotlib#971 from jenshnielsen/close_test_file_v1_1_x
Close fd temp file following rec2csv_bad_shape test
2 parents 7e47149 + 8ee4c35 commit 2c85848

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

lib/matplotlib/tests/test_mlab.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,14 @@ def test_recarray_csv_roundtrip():
2727

2828
@raises(ValueError)
2929
def test_rec2csv_bad_shape():
30-
bad = np.recarray((99,4),[('x',np.float),('y',np.float)])
31-
fd = tempfile.TemporaryFile(suffix='csv')
32-
33-
# the bad recarray should trigger a ValueError for having ndim > 1.
34-
mlab.rec2csv(bad,fd)
30+
try:
31+
bad = np.recarray((99,4),[('x',np.float),('y',np.float)])
32+
fd = tempfile.TemporaryFile(suffix='csv')
33+
34+
# the bad recarray should trigger a ValueError for having ndim > 1.
35+
mlab.rec2csv(bad,fd)
36+
finally:
37+
fd.close()
3538

3639
def test_prctile():
3740
# test odd lengths

0 commit comments

Comments
 (0)