Permalink
Browse files

Close temp file following rec2csv_bad_shape test to avoid warning in …

…python3
  • Loading branch information...
1 parent a9adc68 commit 8ee4c353b976d9e24e9279e16fec4e36f436c992 @jenshnielsen committed Jun 29, 2012
Showing with 8 additions and 5 deletions.
  1. +8 −5 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 8ee4c35

Please sign in to comment.