Exemple #1
0
def session(db, request):
    """Creates a new database session for a test."""
    connection = db.engine.connect()
    transaction = connection.begin()

    options = dict(bind=connection, binds={})
    session = db.create_scoped_session(options=options)
    
    db.session = session
    init_data(session)
    def teardown():
        transaction.rollback()
        connection.close()
        session.remove()

    request.addfinalizer(teardown)
    return session
Exemple #2
0
def session(db, request):
    """Creates a new database session for a test."""
    connection = db.engine.connect()
    transaction = connection.begin()

    options = dict(bind=connection, binds={})
    session = db.create_scoped_session(options=options)
    
    db.session = session
    init_data(session)
    def teardown():
        transaction.rollback()
        connection.close()
        session.remove()

    request.addfinalizer(teardown)
    return session
Exemple #3
0
def session(db, request):
    """Creates a new database session for a test."""
    #connection = db.engine.connect()
    #transaction = connection.begin()

    #options = dict(bind=connection, binds={})
    #session = db.create_session(options=options)
    
    #db.session = session
    init_data(db.session)
    def teardown():
        #transaction.rollback()
        #connection.close()
        #session.remove()
        pass

    request.addfinalizer(teardown)
    return db.session
Exemple #4
0
def session(db, request):
    """Creates a new database session for a test."""
    #connection = db.engine.connect()
    #transaction = connection.begin()

    #options = dict(bind=connection, binds={})
    #session = db.create_session(options=options)

    #db.session = session
    init_data(db.session)

    def teardown():
        #transaction.rollback()
        #connection.close()
        #session.remove()
        pass

    request.addfinalizer(teardown)
    return db.session