Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,16 @@ Make sure ``DJANGO_SETTINGS_MODULE`` is defined (see
:ref:`configuring_django_settings`) and make your tests discoverable
(see :ref:`faq-tests-not-being-picked-up`):

By default, pytest-django does not depend on Django. If you want to ensure your
Django version is compatible with the installed pytest-django version (lower
bound only), it's recommended to add the ``django`` `extra`_::

.. code-block:: bash

$ pip install pytest-django[django]

.. _extra: https://packaging.python.org/en/latest/tutorials/installing-packages/#installing-extras

Example using pytest.ini or tox.ini
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Expand Down
8 changes: 8 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,14 @@ dependencies = [
"pytest>=7.0.0",
]
[project.optional-dependencies]
# pytest-django intentionally does not depend on Django. The django extra
# adds the dependency. The idea is that users can specify it to obtain the
# lower-bound constraint on pytest-django's supported Django versions. This
# way if they use an older version of Django, the dependency resolver will
# give them an older, compatible version of pytest-django.
django = [
"django>=5.2",
]
# .readthedocs.yml doesn't support dependency groups yet, so duplicate the docs
# group as an extra. Can be removed once RTD supports groups.
docs = [
Expand Down