Skip to content

Commit

Permalink
fixup! Do not call django.setup() multiple times
Browse files Browse the repository at this point in the history
[ci skip]
  • Loading branch information
blueyed committed Jul 26, 2018
1 parent c0031db commit cfc47c2
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions docs/configuring_django.rst
Original file line number Diff line number Diff line change
Expand Up @@ -83,13 +83,14 @@ This can be done from your project's ``conftest.py`` file::
def pytest_configure():
settings.configure(DATABASES=...)

Changing your app before Django gets setup
------------------------------------------
Changing your app before Django gets set up
-------------------------------------------

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

@pytest.hookimpl(tryfirst=True)
def pytest_load_initial_conftests(early_config, parser, args):
Expand Down

0 comments on commit cfc47c2

Please sign in to comment.