--- a/server/test/unittest_extlite.py Mon Jun 29 21:13:54 2009 +0200
+++ b/server/test/unittest_extlite.py Mon Jun 29 21:15:07 2009 +0200
@@ -7,37 +7,32 @@
sqlite_file = '_extlite_test.sqlite'
def setUp(self):
cnx1 = get_connection('sqlite', database=self.sqlite_file)
- print 'SET IP'
cu = cnx1.cursor()
cu.execute('CREATE TABLE toto(name integer);')
cnx1.commit()
cnx1.close()
-
+
def tearDown(self):
try:
os.remove(self.sqlite_file)
except:
pass
+
def test(self):
lock = threading.Lock()
-
+
def run_thread():
- print 'run_thread'
cnx2 = get_connection('sqlite', database=self.sqlite_file)
lock.acquire()
- print 't2 sel1'
cu = cnx2.cursor()
cu.execute('SELECT name FROM toto')
self.failIf(cu.fetchall())
cnx2.commit()
- print 'done'
lock.release()
time.sleep(0.1)
lock.acquire()
- print 't2 sel2'
cu.execute('SELECT name FROM toto')
self.failUnless(cu.fetchall())
- print 'done'
lock.release()
cnx1 = get_connection('sqlite', database=self.sqlite_file)
@@ -45,17 +40,13 @@
thread = threading.Thread(target=run_thread)
thread.start()
cu = cnx1.cursor()
- print 't1 sel'
cu.execute('SELECT name FROM toto')
- print 'done'
lock.release()
time.sleep(0.1)
cnx1.commit()
lock.acquire()
- print 't1 insert'
cu.execute("INSERT INTO toto(name) VALUES ('toto')")
cnx1.commit()
- print 'done'
lock.release()
if __name__ == '__main__':