fromsqlobjectimport SQLObject, StringCol
fromsqlobject.tests.dbtestimport getConnection
########################################
# Per-instance connection
########################################
[docs]
classSOTestPerConnection(SQLObject):
test = StringCol()
[docs]
deftest_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