I'm currently running some Django tests and it looks that DEBUG=False
by default. Is there a way to run a specific test where I can set DEBUG=True
at the command line or in code?
The debug mode (DEBUG=True) is turned on by default in the Django framework. It provides a detailed traceback with the local variables to find out the error with the line numbers. The error can be triggered from the view page by setting the value of assert to False in the view file.
For a specific test inside a test case, you can use the override_settings decorator:
from django.test.utils import override_settings from django.conf import settings class TestSomething(TestCase): @override_settings(DEBUG=True) def test_debug(self): assert settings.DEBUG
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With