Skip to content

Commit 3cd0d32

Browse files
committed
Revert "Merge pull request #231 from pytest-dev/no-force-debug"
This reverts commit 73fe800, reversing changes made to fe7d280.
1 parent 464f8b5 commit 3cd0d32

File tree

4 files changed

+1
-50
lines changed

4 files changed

+1
-50
lines changed

docs/changelog.rst

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,6 @@
11
Changelog
22
=========
33

4-
Unreleased
5-
----------
6-
7-
Features
8-
^^^^^^^^
9-
10-
* Added a new option `--no-foce-no-debug` to avoid forcing of DEBUG setting to False (bubenkoff)
11-
124
2.8.0
135
-----
146

docs/configuring_django.rst

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -74,15 +74,3 @@ This can be done from your project's ``conftest.py`` file::
7474
def pytest_configure():
7575
settings.configure(DATABASES=...)
7676

77-
78-
``DEBUG`` setting during the test run
79-
-------------------------------------
80-
81-
Default django test runner behavior is to force DEBUG setting to False. So does the ``pytest-django``.
82-
But sometimes, especially for functional tests, you might want to avoid this, to debug why certain page does not work.
83-
84-
Command Line Option::
85-
86-
$ py.test --no-force-no-debug
87-
88-
will make sure that DEBUG is not forced to False, so you can set it to True in your test settings.

pytest_django/plugin.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,6 @@ def pytest_addoption(parser):
5454
group._addoption('--nomigrations',
5555
action='store_true', dest='nomigrations', default=False,
5656
help='Disable Django 1.7 migrations on test setup')
57-
group._addoption('--no-force-no-debug',
58-
action='store_true', dest='noforcenodebug', default=False,
59-
help='Disable forcing DEBUG setting to False on test setup')
6057
parser.addini(CONFIGURATION_ENV,
6158
'django-configurations class to use by pytest-django.')
6259
group._addoption('--liveserver', default=None,
@@ -254,8 +251,7 @@ def _django_test_environment(request):
254251
_setup_django()
255252
from django.conf import settings
256253
from .compat import setup_test_environment, teardown_test_environment
257-
if not request.config.getvalue('noforcenodebug'):
258-
settings.DEBUG = False
254+
settings.DEBUG = False
259255
setup_test_environment()
260256
request.addfinalizer(teardown_test_environment)
261257

tests/test_django_settings_module.py

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -245,31 +245,6 @@ def test_debug_is_false():
245245
assert r.ret == 0
246246

247247

248-
def test_debug_no_force(testdir, monkeypatch):
249-
monkeypatch.delenv('DJANGO_SETTINGS_MODULE')
250-
testdir.makeconftest("""
251-
from django.conf import settings
252-
253-
def pytest_configure():
254-
settings.configure(SECRET_KEY='set from pytest_configure',
255-
DEBUG=True,
256-
DATABASES={'default': {
257-
'ENGINE': 'django.db.backends.sqlite3',
258-
'NAME': ':memory:'}},
259-
INSTALLED_APPS=['django.contrib.auth',
260-
'django.contrib.contenttypes',])
261-
""")
262-
263-
testdir.makepyfile("""
264-
from django.conf import settings
265-
def test_debug_is_true():
266-
assert settings.DEBUG is True
267-
""")
268-
269-
r = testdir.runpytest('--no-force-no-debug')
270-
assert r.ret == 0
271-
272-
273248
@pytest.mark.skipif(not hasattr(django, 'setup'),
274249
reason="This Django version does not support app loading")
275250
@pytest.mark.django_project(extra_settings="""

0 commit comments

Comments
 (0)