def test_with_real_dbs(): for db in _util.get_dbs(): with db, db.conn as conn: for check in checks: with conn.begin(rollback=True): yield check, conn, csvfile_with_header() with conn.begin(rollback=True): yield check, conn, csvfile_no_header()
def test_createdb(): for db in get_dbs(): uridict = generic.createdb(db.uridict) try: generic.createdb(uridict, force=True) # check that force works finally: generic.dropdb(uridict) yield lambda u: u, uridict
def test_independent_connections(): db, = get_dbs('mysqldb') with db: conn1 = db.conn with conn1.opencopy() as conn2: conn2.echo = True conn2.execute("insert into client values ('pippo', 'fake client')") # no primary key error conn1.execute("insert into client values ('pippo', 'fake client')")
def test_error_in_commit_rollback(): for db in get_dbs(): with db: for rollback in True, False: try: with db.conn.begin(rollback): db.conn.all('select * from rpp') db.conn.dbapi.close() # simulating dropping of the underlying connection except Exception as e: # make sure the high level connection is marked closed assert not db.conn.opened # closed by conn.rollback() # check the error message yield print_error, db, e
def _test_alchemy(): for db in get_dbs('psycopg2', 'mysqldb'): with db: yield sqlalchemy_speed, db
def test_function(): for db in get_dbs(): with db: yield check, db yield measure_speed, db