Skip to content

Commit e2e805f

Browse files
committed
docs: some minor fixes & improvements
1 parent 15e6132 commit e2e805f

File tree

5 files changed

+20
-20
lines changed

5 files changed

+20
-20
lines changed

docs/changelog.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -426,7 +426,7 @@ v3.3.3 (2018-07-26)
426426
Bug fixes
427427
^^^^^^^^^
428428

429-
* Fixed registration of :py:func:`~pytest.mark.ignore_template_errors` marker,
429+
* Fixed registration of :func:`~pytest.mark.ignore_template_errors` marker,
430430
which is required with ``pytest --strict`` (#609).
431431
* Fixed another regression with unittest (#624, #625).
432432

@@ -458,7 +458,7 @@ Features
458458

459459
* Added new fixtures ``django_mail_dnsname`` and ``django_mail_patch_dns``,
460460
used by ``mailoutbox`` to monkeypatch the ``DNS_NAME`` used in
461-
:py:mod:`django.core.mail` to improve performance and
461+
:mod:`django.core.mail` to improve performance and
462462
reproducibility.
463463

464464
Bug fixes

docs/configuring_django.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,9 +118,9 @@ but it can also be requested individually per-test.
118118
Changing your app before Django gets set up
119119
-------------------------------------------
120120

121-
pytest-django calls :py:func:`django.setup` automatically. If you want to do
121+
pytest-django calls :func:`django.setup` automatically. If you want to do
122122
anything before this, you have to create a pytest plugin and use
123-
the :py:func:`~_pytest.hookspec.pytest_load_initial_conftests` hook, with
123+
the :func:`~_pytest.hookspec.pytest_load_initial_conftests` hook, with
124124
``tryfirst=True``, so that it gets run before the hook in pytest-django
125125
itself::
126126

docs/database.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,14 +77,14 @@ Tests requiring multiple databases
7777
``pytest-django`` has experimental support for multi-database configurations.
7878
Currently ``pytest-django`` does not specifically support Django's
7979
multi-database support, using the ``databases`` argument to the
80-
:py:func:`django_db <pytest.mark.django_db>` mark::
80+
:func:`django_db <pytest.mark.django_db>` mark::
8181

8282
@pytest.mark.django_db(databases=['default', 'other'])
8383
def test_spam():
8484
assert MyModel.objects.using('other').count() == 0
8585

86-
For details see :py:attr:`django.test.TransactionTestCase.databases` and
87-
:py:attr:`django.test.TestCase.databases`.
86+
For details see :attr:`django.test.TransactionTestCase.databases` and
87+
:attr:`django.test.TestCase.databases`.
8888

8989

9090
``--reuse-db`` - reuse the testing database between test runs

docs/faq.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ test runner like this:
9090
help='Preserves the test DB between runs.'
9191
)
9292
93-
def run_tests(self, test_labels):
93+
def run_tests(self, test_labels, **kwargs):
9494
"""Run pytest and return the exitcode.
9595
9696
It translates some of Django's test command option to pytest's.
@@ -126,7 +126,7 @@ Usage:
126126
127127
**Note**: the pytest-django command line options ``--ds`` and ``--dc`` are not
128128
compatible with this approach, you need to use the standard Django methods of
129-
setting the ``DJANGO_SETTINGS_MODULE``/``DJANGO_CONFIGURATION`` environmental
129+
setting the ``DJANGO_SETTINGS_MODULE``/``DJANGO_CONFIGURATION`` environment
130130
variables or the ``--settings`` command line option.
131131

132132
How can I give database access to all my tests without the `django_db` marker?

docs/helpers.rst

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Django helpers
66
Assertions
77
----------
88

9-
All of Django's :py:class:`~django:django.test.TestCase`
9+
All of Django's :class:`~django:django.test.TestCase`
1010
:ref:`django:assertions` are available in ``pytest_django.asserts``, e.g.
1111

1212
::
@@ -26,7 +26,7 @@ dynamically in a hook or fixture.
2626
``pytest.mark.django_db`` - request database access
2727
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2828

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])
3030

3131
This is used to mark a test function as requiring the database. It
3232
will ensure the database is set up correctly for the test. Each test
@@ -54,10 +54,10 @@ dynamically in a hook or fixture.
5454
values (e.g. primary keys) before running the test. Defaults to
5555
``False``. Must be used together with ``transaction=True`` to have an
5656
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`.
5858

5959

60-
:type databases: Union[Iterable[str], str, None]
60+
:type databases: Iterable[str] | str | None
6161
:param databases:
6262
.. caution::
6363

@@ -70,8 +70,8 @@ dynamically in a hook or fixture.
7070
configuration will be set up and may be used by the test. Defaults to
7171
only the ``default`` database. The special value ``"__all__"`` may be use
7272
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`.
7575

7676
:type serialized_rollback: bool
7777
:param serialized_rollback:
@@ -84,7 +84,7 @@ dynamically in a hook or fixture.
8484

8585
Note that this will slow down that test suite by approximately 3x.
8686

87-
:type available_apps: Union[List[str], None]
87+
:type available_apps: Iterable[str] | None
8888
:param available_apps:
8989
.. caution::
9090

@@ -97,7 +97,7 @@ dynamically in a hook or fixture.
9797
model tables will be emptied after each test (this truncation may cascade
9898
to unavailable apps models).
9999

100-
For details see :py:attr:`django.test.TransactionTestCase.available_apps`
100+
For details see :attr:`django.test.TransactionTestCase.available_apps`
101101

102102

103103
.. note::
@@ -122,7 +122,7 @@ dynamically in a hook or fixture.
122122
``pytest.mark.urls`` - override the urlconf
123123
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
124124

125-
.. py:function:: pytest.mark.urls(urls)
125+
.. decorator:: pytest.mark.urls(urls)
126126

127127
Specify a different ``settings.ROOT_URLCONF`` module for the marked tests.
128128

@@ -141,7 +141,7 @@ dynamically in a hook or fixture.
141141
``pytest.mark.ignore_template_errors`` - ignore invalid template variables
142142
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
143143

144-
.. py:function:: pytest.mark.ignore_template_errors
144+
.. decorator:: pytest.mark.ignore_template_errors
145145

146146
Ignore errors when using the ``--fail-on-template-vars`` option, i.e.
147147
do not cause tests to fail if your templates contain invalid variables.
@@ -540,7 +540,7 @@ Example
540540

541541

542542
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
544544
the ``django_mail_dnsname`` fixture, which defaults to
545545
"fake-tests.example.com".
546546

0 commit comments

Comments
 (0)