Show More
@@ -18,6 +18,7 b' Authors:' | |||||
18 |
|
18 | |||
19 | from __future__ import division |
|
19 | from __future__ import division | |
20 |
|
20 | |||
|
21 | import os | |||
21 | import tempfile |
|
22 | import tempfile | |
22 | import time |
|
23 | import time | |
23 |
|
24 | |||
@@ -37,6 +38,12 b' from IPython.zmq.session import Session' | |||||
37 | # TestCases |
|
38 | # TestCases | |
38 | #------------------------------------------------------------------------------- |
|
39 | #------------------------------------------------------------------------------- | |
39 |
|
40 | |||
|
41 | ||||
|
42 | def setup(): | |||
|
43 | global temp_db | |||
|
44 | temp_db = tempfile.NamedTemporaryFile(suffix='.db').name | |||
|
45 | ||||
|
46 | ||||
40 | class TestDictBackend(TestCase): |
|
47 | class TestDictBackend(TestCase): | |
41 | def setUp(self): |
|
48 | def setUp(self): | |
42 | self.session = Session() |
|
49 | self.session = Session() | |
@@ -218,7 +225,16 b' class TestSQLiteBackend(TestDictBackend):' | |||||
218 |
|
225 | |||
219 | @dec.skip_without('sqlite3') |
|
226 | @dec.skip_without('sqlite3') | |
220 | def create_db(self): |
|
227 | def create_db(self): | |
221 | return SQLiteDB(location=tempfile.gettempdir()) |
|
228 | location, fname = os.path.split(temp_db) | |
|
229 | return SQLiteDB(location=location, fname=fname) | |||
222 |
|
230 | |||
223 | def tearDown(self): |
|
231 | def tearDown(self): | |
224 | self.db._db.close() |
|
232 | self.db._db.close() | |
|
233 | ||||
|
234 | ||||
|
235 | def teardown(): | |||
|
236 | """cleanup task db file after all tests have run""" | |||
|
237 | try: | |||
|
238 | os.remove(temp_db) | |||
|
239 | except: | |||
|
240 | pass |
General Comments 0
You need to be logged in to leave comments.
Login now