B [server] extlite test will not fail if tempfile exists stable
authorNicolas Chauvat <nicolas.chauvat@logilab.fr>
Fri, 14 Aug 2009 18:54:35 +0200
branchstable
changeset 2857 81d10fedc32e
parent 2856 ef3d02642b4c
child 2858 322272c5d67f
B [server] extlite test will not fail if tempfile exists
server/test/unittest_extlite.py
--- a/server/test/unittest_extlite.py	Fri Aug 14 18:34:42 2009 +0200
+++ b/server/test/unittest_extlite.py	Fri Aug 14 18:54:35 2009 +0200
@@ -5,7 +5,15 @@
 
 class SQLiteTC(TestCase):
     sqlite_file = '_extlite_test.sqlite'
+
+    def _cleanup(self):
+        try:
+            os.remove(self.sqlite_file)
+        except:
+            pass
+
     def setUp(self):
+        self._cleanup()
         cnx1 = get_connection('sqlite', database=self.sqlite_file)
         cu = cnx1.cursor()
         cu.execute('CREATE TABLE toto(name integer);')
@@ -13,10 +21,7 @@
         cnx1.close()
 
     def tearDown(self):
-        try:
-            os.remove(self.sqlite_file)
-        except:
-            pass
+        self._cleanup()
 
     def test(self):
         lock = threading.Lock()