Exemplo n.º 1
0
def fixture_db_session(empty_db_connection):
    """
    Provide a Session connected to the empty database.

    We use nested transactions to return the database to empty after each test.
    """
    nested_transaction = empty_db_connection.begin_nested()
    session_factory.configure(bind=empty_db_connection)
    session = session_registry()
    yield session
    session_registry.remove()
    nested_transaction.rollback()
Exemplo n.º 2
0
def fixture_db_session(empty_db_connection):
    """
    Provide a Session connected to the empty database.

    We use nested transactions to return the database to empty after each test.
    """
    nested_transaction = empty_db_connection.begin_nested()
    session_factory.configure(bind=empty_db_connection)
    session = session_registry()
    yield session
    session_registry.remove()
    nested_transaction.rollback()
Exemplo n.º 3
0
def shutdown_session(exception=None):
    session_registry.remove()