コード例 #1
0
def db_session(request, django_db_setup, django_db_blocker):
    if 'django_db_reset_sequences' in request.funcargnames:
        request.getfixturevalue('django_db_reset_sequences')
    if 'transactional_db' in request.funcargnames or 'live_server' in request.funcargnames:
        request.getfixturevalue('transactional_db')
    else:
        _django_db_fixture_helper(request, django_db_blocker, transactional=False)
コード例 #2
0
def class_scoped_db(request, django_db_blocker):
    """A class-scoped DB fixture

    The normal pytest-django `db` fixture is function-scoped, meaning that it
    gets torn down and set up again for every test case in a class.

    This reproduces the core bits of that with class scope, allowing a class
    with multiple tests in which the same DB transaction is used for all tests
    in the class.
    """
    _django_db_fixture_helper(request=request, django_db_blocker=django_db_blocker)
コード例 #3
0
ファイル: conftest.py プロジェクト: maxide/Bank-1
def enable_db_access_for_all_tests(request, django_db_setup,
                                   django_db_blocker):
    from pytest_django.fixtures import _django_db_fixture_helper
    django_db_blocker.unblock()
    _django_db_fixture_helper(request, django_db_blocker, transactional=True)