Skip to content

Commit 79a500b

Browse files
committed
Prefixed fixture name with django_
1 parent 7d5add6 commit 79a500b

File tree

4 files changed

+11
-11
lines changed

4 files changed

+11
-11
lines changed

docs/helpers.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ of the test. This behavior is the same as Django's standard
2626

2727
In order for a test to have access to the database it must either
2828
be marked using the ``django_db`` mark or request one of the ``db``,
29-
``transactional_db`` or ``multi_db`` fixtures. Otherwise the test will
29+
``transactional_db`` or ``django_multi_db`` fixtures. Otherwise the test will
3030
fail when trying to access the database.
3131

3232
:type transaction: bool
@@ -52,7 +52,7 @@ fail when trying to access the database.
5252
this marker will not help even if the function requesting your
5353
fixture has this marker applied. To access the database in a
5454
fixture, the fixture itself will have to request the ``db``,
55-
``transactional_db`` or ``multi_db`` fixture. See below for a
55+
``transactional_db`` or ``django_multi_db`` fixture. See below for a
5656
description of them.
5757

5858
.. note:: Automatic usage with ``django.test.TestCase``.
@@ -201,8 +201,8 @@ transaction support. This is only required for fixtures which need
201201
database access themselves. A test function would normally use the
202202
:py:func:`~pytest.mark.django_db` mark to signal it needs the database.
203203

204-
``multi_db``
205-
~~~~~~~~~~~~
204+
``django_multi_db``
205+
~~~~~~~~~~~~~~~~~~
206206

207207
This fixture can be used to request access to the database including
208208
multiple database support. This is only required for fixtures which

pytest_django/fixtures.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
from .lazy_django import get_django_version, skip_if_no_django
1414

15-
__all__ = ['django_db_setup', 'db', 'transactional_db', 'multi_db',
15+
__all__ = ['django_db_setup', 'db', 'transactional_db', 'django_multi_db',
1616
'admin_user', 'django_user_model', 'django_username_field',
1717
'client', 'admin_client', 'rf', 'settings', 'live_server',
1818
'_live_server_helper']
@@ -177,7 +177,7 @@ def transactional_db(request, django_db_setup, django_db_blocker):
177177

178178

179179
@pytest.fixture(scope='function')
180-
def multi_db(request, django_db_setup, django_db_blocker):
180+
def django_multi_db(request, django_db_setup, django_db_blocker):
181181
"""Require a django test database
182182
183183
This behaves like the ``db`` fixture, with the addition of marking

pytest_django/plugin.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
from .fixtures import live_server # noqa
3131
from .fixtures import rf # noqa
3232
from .fixtures import settings # noqa
33-
from .fixtures import transactional_db, multi_db # noqa
33+
from .fixtures import transactional_db, django_multi_db # noqa
3434

3535
from .lazy_django import (django_settings_is_configured,
3636
get_django_version, skip_if_no_django)
@@ -364,15 +364,15 @@ def _django_db_marker(request):
364364
"""Implement the django_db marker, internal to pytest-django.
365365
366366
This will dynamically request the ``db``, ``transactional_db``
367-
or ``multi_db`` fixtures as required by the django_db marker.
367+
or ``django_multi_db`` fixtures as required by the django_db marker.
368368
"""
369369
marker = request.keywords.get('django_db', None)
370370
if marker:
371371
validate_django_db(marker)
372372
if marker.transaction:
373373
request.getfuncargvalue('transactional_db')
374374
elif marker.multi_db:
375-
request.getfuncargvalue('multi_db')
375+
request.getfuncargvalue('django_multi_db')
376376
else:
377377
request.getfuncargvalue('db')
378378

tests/test_database.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,11 @@ def test_transactions_enabled(self, transactional_db):
5656

5757
assert not connection.in_atomic_block
5858

59-
def test_multi_db_enabled(self, multi_db):
59+
def test_multi_db_enabled(self, django_multi_db):
6060
# TODO
6161
pass
6262

63-
def test_multi_db_transactions_enabled(self, transactional_db, multi_db):
63+
def test_multi_db_transactions_enabled(self, transactional_db, django_multi_db):
6464
# TODO
6565
pass
6666

0 commit comments

Comments
 (0)