From 827c34618283480122971093d4efa9df2512e534 Mon Sep 17 00:00:00 2001 From: Andreas Pelme Date: Sun, 26 Jul 2015 20:51:47 +0200 Subject: [PATCH] Revert "Merge pull request #231 from pytest-dev/no-force-debug" This reverts commit 73fe800666feb47d1172876dcf07f99ed1604aee, reversing changes made to fe7d2801ea3fd6a160b97b781112ecbf3e60fd80. --- docs/changelog.rst | 8 -------- docs/configuring_django.rst | 12 ------------ pytest_django/plugin.py | 6 +----- tests/test_django_settings_module.py | 25 ------------------------- 4 files changed, 1 insertion(+), 50 deletions(-) diff --git a/docs/changelog.rst b/docs/changelog.rst index 4eef49ae3..4d9884e51 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -1,14 +1,6 @@ Changelog ========= -Unreleased ----------- - -Features -^^^^^^^^ - -* Added a new option `--no-foce-no-debug` to avoid forcing of DEBUG setting to False (bubenkoff) - 2.8.0 ----- diff --git a/docs/configuring_django.rst b/docs/configuring_django.rst index 4181c0d10..6281434b2 100644 --- a/docs/configuring_django.rst +++ b/docs/configuring_django.rst @@ -74,15 +74,3 @@ This can be done from your project's ``conftest.py`` file:: def pytest_configure(): settings.configure(DATABASES=...) - -``DEBUG`` setting during the test run -------------------------------------- - -Default django test runner behavior is to force DEBUG setting to False. So does the ``pytest-django``. -But sometimes, especially for functional tests, you might want to avoid this, to debug why certain page does not work. - -Command Line Option:: - - $ py.test --no-force-no-debug - -will make sure that DEBUG is not forced to False, so you can set it to True in your test settings. diff --git a/pytest_django/plugin.py b/pytest_django/plugin.py index f45208fc9..9a421b12e 100644 --- a/pytest_django/plugin.py +++ b/pytest_django/plugin.py @@ -54,9 +54,6 @@ def pytest_addoption(parser): group._addoption('--nomigrations', action='store_true', dest='nomigrations', default=False, help='Disable Django 1.7 migrations on test setup') - group._addoption('--no-force-no-debug', - action='store_true', dest='noforcenodebug', default=False, - help='Disable forcing DEBUG setting to False on test setup') parser.addini(CONFIGURATION_ENV, 'django-configurations class to use by pytest-django.') group._addoption('--liveserver', default=None, @@ -254,8 +251,7 @@ def _django_test_environment(request): _setup_django() from django.conf import settings from .compat import setup_test_environment, teardown_test_environment - if not request.config.getvalue('noforcenodebug'): - settings.DEBUG = False + settings.DEBUG = False setup_test_environment() request.addfinalizer(teardown_test_environment) diff --git a/tests/test_django_settings_module.py b/tests/test_django_settings_module.py index 3312a7d0c..7a697b60d 100644 --- a/tests/test_django_settings_module.py +++ b/tests/test_django_settings_module.py @@ -245,31 +245,6 @@ def test_debug_is_false(): assert r.ret == 0 -def test_debug_no_force(testdir, monkeypatch): - monkeypatch.delenv('DJANGO_SETTINGS_MODULE') - testdir.makeconftest(""" - from django.conf import settings - - def pytest_configure(): - settings.configure(SECRET_KEY='set from pytest_configure', - DEBUG=True, - DATABASES={'default': { - 'ENGINE': 'django.db.backends.sqlite3', - 'NAME': ':memory:'}}, - INSTALLED_APPS=['django.contrib.auth', - 'django.contrib.contenttypes',]) - """) - - testdir.makepyfile(""" - from django.conf import settings - def test_debug_is_true(): - assert settings.DEBUG is True - """) - - r = testdir.runpytest('--no-force-no-debug') - assert r.ret == 0 - - @pytest.mark.skipif(not hasattr(django, 'setup'), reason="This Django version does not support app loading") @pytest.mark.django_project(extra_settings="""