@@ -6,7 +6,7 @@ Django helpers
6
6
Assertions
7
7
----------
8
8
9
- All of Django's :py: class: `~django:django.test.TestCase `
9
+ All of Django's :class: `~django:django.test.TestCase `
10
10
:ref: `django:assertions ` are available in ``pytest_django.asserts ``, e.g.
11
11
12
12
::
@@ -26,7 +26,7 @@ dynamically in a hook or fixture.
26
26
``pytest.mark.django_db `` - request database access
27
27
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
28
28
29
- .. py : function :: pytest.mark.django_db([transaction=False , reset_sequences=False , databases=None ])
29
+ .. decorator :: pytest.mark.django_db([transaction=False, reset_sequences=False, databases=None, serialized_rollback=False, available_apps =None])
30
30
31
31
This is used to mark a test function as requiring the database. It
32
32
will ensure the database is set up correctly for the test. Each test
@@ -54,10 +54,10 @@ dynamically in a hook or fixture.
54
54
values (e.g. primary keys) before running the test. Defaults to
55
55
``False ``. Must be used together with ``transaction=True `` to have an
56
56
effect. Please be aware that not all databases support this feature.
57
- For details see :py: attr: `django.test.TransactionTestCase.reset_sequences `.
57
+ For details see :attr: `django.test.TransactionTestCase.reset_sequences `.
58
58
59
59
60
- :type databases: Union[ Iterable[str], str, None]
60
+ :type databases: Iterable[str] | str | None
61
61
:param databases:
62
62
.. caution ::
63
63
@@ -70,8 +70,8 @@ dynamically in a hook or fixture.
70
70
configuration will be set up and may be used by the test. Defaults to
71
71
only the ``default `` database. The special value ``"__all__" `` may be use
72
72
to specify all configured databases.
73
- For details see :py: attr: `django.test.TransactionTestCase.databases ` and
74
- :py: attr: `django.test.TestCase.databases `.
73
+ For details see :attr: `django.test.TransactionTestCase.databases ` and
74
+ :attr: `django.test.TestCase.databases `.
75
75
76
76
:type serialized_rollback: bool
77
77
:param serialized_rollback:
@@ -84,7 +84,7 @@ dynamically in a hook or fixture.
84
84
85
85
Note that this will slow down that test suite by approximately 3x.
86
86
87
- :type available_apps: Union[List[ str], None]
87
+ :type available_apps: Iterable[ str] | None
88
88
:param available_apps:
89
89
.. caution ::
90
90
@@ -97,7 +97,7 @@ dynamically in a hook or fixture.
97
97
model tables will be emptied after each test (this truncation may cascade
98
98
to unavailable apps models).
99
99
100
- For details see :py: attr: `django.test.TransactionTestCase.available_apps `
100
+ For details see :attr: `django.test.TransactionTestCase.available_apps `
101
101
102
102
103
103
.. note ::
@@ -122,7 +122,7 @@ dynamically in a hook or fixture.
122
122
``pytest.mark.urls `` - override the urlconf
123
123
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
124
124
125
- .. py : function :: pytest.mark.urls(urls)
125
+ .. decorator :: pytest.mark.urls(urls)
126
126
127
127
Specify a different ``settings.ROOT_URLCONF `` module for the marked tests.
128
128
@@ -141,7 +141,7 @@ dynamically in a hook or fixture.
141
141
``pytest.mark.ignore_template_errors `` - ignore invalid template variables
142
142
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
143
143
144
- .. py : function :: pytest.mark.ignore_template_errors
144
+ .. decorator :: pytest.mark.ignore_template_errors
145
145
146
146
Ignore errors when using the ``--fail-on-template-vars `` option, i.e.
147
147
do not cause tests to fail if your templates contain invalid variables.
@@ -540,7 +540,7 @@ Example
540
540
541
541
542
542
This uses the ``django_mail_patch_dns `` fixture, which patches
543
- ``DNS_NAME `` used by :py: mod: `django.core.mail ` with the value from
543
+ ``DNS_NAME `` used by :mod: `django.core.mail ` with the value from
544
544
the ``django_mail_dnsname `` fixture, which defaults to
545
545
"fake-tests.example.com".
546
546
0 commit comments