I have written some unit tests for my model using sqlite in-memory dbs.
It all works with a single thread, but fails with multiple threads.
Any ideas on how I can solve this problem? Thanks
My Error: OperationalError: no such table: table2
How I do it...
class DBTestCase(unittest.TestCase):
def setUp(self):
unittest.TestCase.setUp(self)
database.set_db_uri('sqlite:///:memory:')
for obj in [model.table1, model.table2,
model.table3]:
obj.createTable()
#obj.createIndexes()
def tearDown(self):
for obj in [model.table1, model.table2,
model.table3]:
obj.dropTable()
unittest.TestCase.tearDown(self)
class ThreadTestCase(DBTestCase):
def setUp(self):
DBTestCase.setUp(self)
.... # setup db
def testthreads(self):
t1 = controllers.processorThread('1')
t2 = controllers.processorThread('1')
t1.start()
t2.start()
.... # wait ERROR HAPPENS WHILE WAITING
t1.join()
t2.join()
.... # look at contents
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"TurboGears" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/turbogears
-~----------~----~----~----~------~----~------~--~---