コード例 #1
0
ファイル: test_toolbox.py プロジェクト: micheles/sqlplain
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()
コード例 #2
0
ファイル: test_core.py プロジェクト: pombredanne/sqlplain
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
コード例 #3
0
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')")
コード例 #4
0
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
コード例 #5
0
ファイル: test_sql.py プロジェクト: pombredanne/sqlplain
def _test_alchemy():
    for db in get_dbs('psycopg2', 'mysqldb'):
        with db:
            yield sqlalchemy_speed, db
コード例 #6
0
ファイル: test_sql.py プロジェクト: pombredanne/sqlplain
def test_function():
    for db in get_dbs():
        with db:
            yield check, db
            yield measure_speed, db