Skip to content

Add django_debug_mode to configure how DEBUG is set in tests #888

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Oct 17, 2020
Merged
Changes from 1 commit
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
Next Next commit
Let django's setup/teardown set DEBUG for us
It properly restores it as well.
  • Loading branch information
bluetech committed Oct 16, 2020
commit 65a25250de7a021f0f44f58c16adcc077d0e89d7
4 changes: 1 addition & 3 deletions pytest_django/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -445,11 +445,9 @@ def django_test_environment(request):
"""
if django_settings_is_configured():
_setup_django()
from django.conf import settings as dj_settings
from django.test.utils import setup_test_environment, teardown_test_environment

dj_settings.DEBUG = False
setup_test_environment()
setup_test_environment(debug=False)
request.addfinalizer(teardown_test_environment)


Expand Down