Skip to content
Browse files

Merge pull request #971 from jenshnielsen/close_test_file_v1_1_x

Close fd temp file following rec2csv_bad_shape test
  • Loading branch information...
2 parents 7e47149 + 8ee4c35 commit 2c85848f682de528c1ef2c1b7e35e0bf53e08683 @mdboom mdboom committed Jul 2, 2012
Showing with 8 additions and 5 deletions.
  1. +8 −5 lib/matplotlib/tests/test_mlab.py
View
13 lib/matplotlib/tests/test_mlab.py
@@ -27,11 +27,14 @@ def test_recarray_csv_roundtrip():
@raises(ValueError)
def test_rec2csv_bad_shape():
- bad = np.recarray((99,4),[('x',np.float),('y',np.float)])
- fd = tempfile.TemporaryFile(suffix='csv')
-
- # the bad recarray should trigger a ValueError for having ndim > 1.
- mlab.rec2csv(bad,fd)
+ try:
+ bad = np.recarray((99,4),[('x',np.float),('y',np.float)])
+ fd = tempfile.TemporaryFile(suffix='csv')
+
+ # the bad recarray should trigger a ValueError for having ndim > 1.
+ mlab.rec2csv(bad,fd)
+ finally:
+ fd.close()
def test_prctile():
# test odd lengths

0 comments on commit 2c85848

Please sign in to comment.
Something went wrong with that request. Please try again.