[SQL-CVS] r4376 - SQLObject/trunk/sqlobject/tests
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
|
From: <sub...@co...> - 2011-04-18 10:12:03
|
Author: phd
Date: Mon Apr 18 04:11:50 2011
New Revision: 4376
Log:
Merged test_sqlite_factory.py and test_sqlite_threaded.py into test_sqlite.py.
Added:
SQLObject/trunk/sqlobject/tests/test_sqlite.py
- copied, changed from r4373, SQLObject/trunk/sqlobject/tests/test_sqlite_factory.py
Deleted:
SQLObject/trunk/sqlobject/tests/test_sqlite_factory.py
SQLObject/trunk/sqlobject/tests/test_sqlite_threaded.py
Copied and modified: SQLObject/trunk/sqlobject/tests/test_sqlite.py (from r4373, SQLObject/trunk/sqlobject/tests/test_sqlite_factory.py)
==============================================================================
--- SQLObject/trunk/sqlobject/tests/test_sqlite_factory.py Mon Mar 28 06:59:57 2011 (r4373, copy source)
+++ SQLObject/trunk/sqlobject/tests/test_sqlite.py Mon Apr 18 04:11:50 2011 (r4376)
@@ -1,6 +1,8 @@
+import threading
from sqlobject import *
from sqlobject.tests.dbtest import *
from sqlobject.tests.dbtest import setSQLiteConnectionFactory
+from test_basic import TestSO1
class SQLiteFactoryTest(SQLObject):
name = StringCol()
@@ -81,3 +83,17 @@
SQLiteFactoryTest(name='sqlbuilder')
assert SQLiteFactoryTest.select(orderBy="name").accumulateOne("group_concat", "name") == \
"sqlbuilder, sqlobject"
+
+
+def do_select():
+ list(TestSO1.select())
+
+def test_sqlite_threaded():
+ setupClass(TestSO1)
+ t = threading.Thread(target=do_select)
+ t.start()
+ t.join()
+ # This should reuse the same connection as the connection
+ # made above (at least will with most database drivers, but
+ # this will cause an error in SQLite):
+ do_select()
|