# Path: tldap/transaction.py
# class TransactionManagementError(Exception):
# class Transaction(object):
# def enter_transaction_management(using=None):
# def leave_transaction_management(using=None):
# def is_dirty(using=None):
# def is_managed(using=None):
# def commit(using=None):
# def rollback(using=None):
#     def __init__(self, entering, exiting, using):
#     def __enter__(self):
#     def __exit__(self, exc_type, exc_value, traceback):
#     def __call__(self, func):
#         def inner(*args, **kwargs):
# def _transaction_func(entering, exiting, using):
# def commit_on_success(using=None):
#     def entering(using):
#     def exiting(exc_value, using):
# def commit_manually(using=None):
#     def entering(using):
#     def exiting(exc_value, using):


import os
import pytest
import tldap
import tldap.backend
import tldap.database
from ldap3.core import exceptions
from pytest_bdd import given, when, then, parsers
from tldap import transaction

    connection = tldap.backend.connections['default']

    with tldap.transaction.commit_manually():
        yield connection
        tldap.transaction.rollback()

    if tldap.transaction.is_managed():
        raise RuntimeError("Unexpected still inside a transaction error.")


@pytest.fixture
def context():
    return {}


@when('we enter a transaction')
def step_start_transaction(ldap):
    transaction.enter_transaction_management()


@when('we commit the transaction')
def step_commit_transaction(ldap):
    transaction.commit()
    transaction.leave_transaction_management()


@when('we rollback the transaction')
def step_rollback_transaction(ldap):
    transaction.rollback()

# Path: tldap/transaction.py
# class TransactionManagementError(Exception):
# class Transaction(object):
# def enter_transaction_management(using=None):
# def leave_transaction_management(using=None):
# def is_dirty(using=None):
# def is_managed(using=None):
# def commit(using=None):
# def rollback(using=None):
#     def __init__(self, entering, exiting, using):
#     def __enter__(self):
#     def __exit__(self, exc_type, exc_value, traceback):
#     def __call__(self, func):
#         def inner(*args, **kwargs):
# def _transaction_func(entering, exiting, using):
# def commit_on_success(using=None):
#     def entering(using):
#     def exiting(exc_value, using):
# def commit_manually(using=None):
#     def entering(using):
#     def exiting(exc_value, using):


# Path: tests/b_integration/conftest.py
import os
import pytest
import tldap
import tldap.backend
import tldap.database
from ldap3.core import exceptions
from pytest_bdd import given, when, then, parsers
from tldap import transaction


    connection = tldap.backend.connections['default']

    with tldap.transaction.commit_manually():
        yield connection
        tldap.transaction.rollback()

    if tldap.transaction.is_managed():
        raise RuntimeError("Unexpected still inside a transaction error.")


@pytest.fixture
def context():
    return {}


@when('we enter a transaction')
def step_start_transaction(ldap):
    transaction.enter_transaction_management()


@when('we commit the transaction')
def step_commit_transaction(ldap):
    transaction.commit()
    transaction.leave_transaction_management()


@when('we rollback the transaction')
def step_rollback_transaction(ldap):
    transaction.rollback()

    transaction.leave_transaction_management()