@@ -37,8 +37,8 @@ documentation <pytest:scoped-marking>` for detail::
37
37
assert me.is_superuser
38
38
39
39
40
- By default ``pytest-django `` will set up the Django databases the
41
- first time a test needs them. Once setup, the database is cached to be
40
+ By default ``pytest-django `` will set up Django databases the
41
+ first time a test needs them. Once setup, a database is cached to be
42
42
used for all subsequent tests and rolls back transactions, to isolate
43
43
tests from each other. This is the same way the standard Django
44
44
:class: `~django.test.TestCase ` uses the database. However
@@ -67,22 +67,16 @@ Tests requiring multiple databases
67
67
68
68
.. versionadded :: 4.3
69
69
70
- .. caution ::
71
-
72
- This support is **experimental ** and is subject to change without
73
- deprecation. We are still figuring out the best way to expose this
74
- functionality. If you are using this successfully or unsuccessfully,
75
- `let us know <https://github.com/pytest-dev/pytest-django/issues/924 >`_!
76
-
77
- ``pytest-django `` has experimental support for multi-database configurations.
78
- Currently ``pytest-django `` does not specifically support Django's
79
- multi-database support, using the ``databases `` argument to the
80
- :func: `django_db <pytest.mark.django_db> ` mark::
70
+ ``pytest-django `` has support for multi-database configurations using the
71
+ ``databases `` argument to the :func: `django_db <pytest.mark.django_db> ` mark::
81
72
82
73
@pytest.mark.django_db(databases=['default', 'other'])
83
74
def test_spam():
84
75
assert MyModel.objects.using('other').count() == 0
85
76
77
+ If you don't specify ``databases ``, only the default database is requested.
78
+ To request all databases, you may use the shortcut ``'__all__' ``.
79
+
86
80
For details see :attr: `django.test.TransactionTestCase.databases ` and
87
81
:attr: `django.test.TestCase.databases `.
88
82
0 commit comments