Skip to content

Implement --debug-mode option to set DEBUG to True prior to run tests #502

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

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
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
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

Features
^^^^^^^^
* Added a new option `--debug-mode` to set the DEBUG setting to True prior to
* Added a new option `--django-debug` to set the DEBUG setting to True prior to
running tests.

3.1.2
Expand Down
4 changes: 2 additions & 2 deletions docs/configuring_django.rst
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,9 @@ This can be done from your project's ``conftest.py`` file::
By default, django test runner forces `DEBUG` setting to `False`, and so does
the ``pytest-django``. But sometimes, especially for functional tests, there is
a need to set `DEBUG` to `True` to investigate why certain page does not work.
To do so, set --debug-mode flag in command line.
To do so, set --django-debug flag in command line.

Command Line Option::

$ pytest --debug-mode
$ pytest --django-debug

4 changes: 2 additions & 2 deletions pytest_django/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,9 @@ def pytest_addoption(parser):
group._addoption('--migrations',
action='store_false', dest='nomigrations', default=False,
help='Enable Django migrations on test setup')
group._addoption('--debug-mode',
help='Set DEBUG to true prior to run tests')
group._addoption('--django-debug',
action='store_true', dest='debug_mode', default=False,
help='Set DEBUG to true prior to run tests')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nitpick (no need to change it already): s/true/True ?!

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll change it. Thanks.

parser.addini(CONFIGURATION_ENV,
'django-configurations class to use by pytest-django.')
group._addoption('--liveserver', default=None,
Expand Down
2 changes: 1 addition & 1 deletion tests/test_django_settings_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ def test_debug_is_true():
assert settings.DEBUG is True
""")

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


Expand Down