[Numpy-svn] r6283 - trunk/numpy/core/tests

numpy-svn@scip... numpy-svn@scip...
Tue Dec 30 19:15:05 CST 2008


Author: ptvirtan
Date: 2008-12-30 19:14:47 -0600 (Tue, 30 Dec 2008)
New Revision: 6283

Modified:
   trunk/numpy/core/tests/test_memmap.py
   trunk/numpy/core/tests/test_multiarray.py
Log:
Fix #951: make tests to clean temp files properly

Modified: trunk/numpy/core/tests/test_memmap.py
===================================================================
--- trunk/numpy/core/tests/test_memmap.py	2008-12-30 22:40:57 UTC (rev 6282)
+++ trunk/numpy/core/tests/test_memmap.py	2008-12-31 01:14:47 UTC (rev 6283)
@@ -14,6 +14,9 @@
         self.data = arange(12, dtype=self.dtype)
         self.data.resize(self.shape)
 
+    def tearDown(self):
+        self.tmpfp.close()
+
     def test_roundtrip(self):
         # Write data to file
         fp = memmap(self.tmpfp, dtype=self.dtype, mode='w+',

Modified: trunk/numpy/core/tests/test_multiarray.py
===================================================================
--- trunk/numpy/core/tests/test_multiarray.py	2008-12-30 22:40:57 UTC (rev 6282)
+++ trunk/numpy/core/tests/test_multiarray.py	2008-12-31 01:14:47 UTC (rev 6283)
@@ -1,5 +1,6 @@
 import tempfile
 import sys
+import os
 import numpy as np
 from numpy.testing import *
 from numpy.core import *
@@ -832,6 +833,7 @@
             tmp_file.flush()
             y = np.fromfile(tmp_file.name,dtype=self.dtype)
             assert_array_equal(y,self.x.flat)
+            tmp_file.close()
 
     def test_filename(self):
         filename = tempfile.mktemp()
@@ -840,6 +842,7 @@
         f.close()
         y = np.fromfile(filename,dtype=self.dtype)
         assert_array_equal(y,self.x.flat)
+        os.unlink(filename)
 
     def test_malformed(self):
         filename = tempfile.mktemp()
@@ -848,6 +851,7 @@
         f.close()
         y = np.fromfile(filename, sep=' ')
         assert_array_equal(y, [1.234, 1.])
+        os.unlink(filename)
 
 class TestFromBuffer(TestCase):
     def tst_basic(self,buffer,expected,kwargs):



More information about the Numpy-svn mailing list