Skip to content

Commit

Permalink
Force ordering of settings and transactional_db fixtures pytest-dev#870
Browse files Browse the repository at this point in the history
  • Loading branch information
bdauvergne committed Sep 24, 2020
1 parent 9d91f0b commit 451e118
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion pytest_django/fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -354,10 +354,13 @@ def finalize(self):


@pytest.yield_fixture()
def settings():
def settings(request):
"""A Django settings object which restores changes after the testrun"""
skip_if_no_django()

if 'transactional_db' in request.fixturenames:
request.getfixturevalue('transactional_db')

wrapper = SettingsWrapper()
yield wrapper
wrapper.finalize()
Expand Down

0 comments on commit 451e118

Please sign in to comment.