Source code for sqlobject.tests.test_perConnection
from sqlobject import SQLObject, StringCol
from sqlobject.tests.dbtest import getConnection
########################################
# Per-instance connection
########################################
[docs]class SOTestPerConnection(SQLObject):
test = StringCol()
[docs]def test_perConnection():
connection = getConnection()
SOTestPerConnection.dropTable(connection=connection, ifExists=True)
SOTestPerConnection.createTable(connection=connection)
SOTestPerConnection(test='test', connection=connection)
assert len(list(SOTestPerConnection.select(
SOTestPerConnection.q.test == 'test', connection=connection))) == 1