Ejemplo n.º 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
Ejemplo n.º 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
Ejemplo n.º 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
Ejemplo n.º 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