##// END OF EJS Templates
generate random task db in tests...
MinRK -
Show More
@@ -38,6 +38,12 b' from IPython.zmq.session import Session'
38 # TestCases
38 # TestCases
39 #-------------------------------------------------------------------------------
39 #-------------------------------------------------------------------------------
40
40
41
42 def setup():
43 global temp_db
44 temp_db = tempfile.NamedTemporaryFile(suffix='.db').name
45
46
41 class TestDictBackend(TestCase):
47 class TestDictBackend(TestCase):
42 def setUp(self):
48 def setUp(self):
43 self.session = Session()
49 self.session = Session()
@@ -189,7 +195,8 b' class TestSQLiteBackend(TestDictBackend):'
189
195
190 @dec.skip_without('sqlite3')
196 @dec.skip_without('sqlite3')
191 def create_db(self):
197 def create_db(self):
192 return SQLiteDB(location=tempfile.gettempdir())
198 location, fname = os.path.split(temp_db)
199 return SQLiteDB(location=location, fname=fname)
193
200
194 def tearDown(self):
201 def tearDown(self):
195 self.db._db.close()
202 self.db._db.close()
@@ -198,6 +205,6 b' class TestSQLiteBackend(TestDictBackend):'
198 def teardown():
205 def teardown():
199 """cleanup task db file after all tests have run"""
206 """cleanup task db file after all tests have run"""
200 try:
207 try:
201 os.remove(os.path.join(tempfile.gettempdir(), 'tasks.db'))
208 os.remove(temp_db)
202 except:
209 except:
203 pass
210 pass
General Comments 0
You need to be logged in to leave comments. Login now