Skip to content

Commit

Permalink
Follow the new convention for Django 11.0
Browse files Browse the repository at this point in the history
a new option --debug-mode has been introduced, so let's name ours
--django-debug-mode
  • Loading branch information
dulacp committed May 24, 2019
1 parent a074460 commit 36c9a0d
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion docs/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Unreleased
Bugfixes
^^^^^^^^

* Added a new option `--django-debug` to specify the default DEBUG setting (#228)
* Added a new option `--django-debug-mode` to specify the default DEBUG setting (#228)

3.4.8 (2019-02-26)
------------------
Expand Down
2 changes: 1 addition & 1 deletion docs/configuring_django.rst
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ But sometimes, especially for functional tests, you might want to avoid this, to

Command Line Option::

$ py.test --django-debug True|False|None
$ py.test --django-debug-mode True|False|None

``None`` ensure there is no override of the test settings DEBUG value
``True`` override DEBUG to True
Expand Down
8 changes: 4 additions & 4 deletions pytest_django/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,9 @@ def pytest_addoption(parser):
help="Enable Django migrations on test setup",
)
group._addoption(
"--django-debug",
"--django-debug-mode",
action="store",
dest="djangodebug",
dest="djangodebugmode",
default="None",
help="Configure the DEBUG setting. Defaults to False"
)
Expand Down Expand Up @@ -474,8 +474,8 @@ def django_test_environment(request):
from django.conf import settings as dj_settings
from django.test.utils import setup_test_environment, teardown_test_environment

if request.config.getvalue('djangodebug') != 'None':
dj_settings.DEBUG = bool(strtobool(request.config.getvalue('djangodebug')))
if request.config.getvalue('djangodebugmode') != 'None':
dj_settings.DEBUG = bool(strtobool(request.config.getvalue('djangodebugmode')))

setup_test_environment()
request.addfinalizer(teardown_test_environment)
Expand Down
6 changes: 3 additions & 3 deletions tests/test_django_settings_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ def test_debug_is_unchanged():
assert settings.DEBUG is True
""")

r = testdir.runpytest_subprocess('--django-debug=None')
r = testdir.runpytest_subprocess('--django-debug-mode=None')
assert r.ret == 0


Expand All @@ -354,7 +354,7 @@ def test_debug_is_false():
assert settings.DEBUG is False
""")

r = testdir.runpytest_subprocess('--django-debug=False')
r = testdir.runpytest_subprocess('--django-debug-mode=False')
assert r.ret == 0


Expand All @@ -379,7 +379,7 @@ def test_debug_is_true():
assert settings.DEBUG is True
""")

r = testdir.runpytest_subprocess('--django-debug=True')
r = testdir.runpytest_subprocess('--django-debug-mode=True')
assert r.ret == 0


Expand Down

0 comments on commit 36c9a0d

Please sign in to comment.