I'm aware that django test cases are done with DEBUG=False and TEMPLATE_DEBUG=False, and that I can change it to True for a specific function, using
from django.test.utils import override_settings
@override_settings(DEBUG=True)
def test_one_function(self):
# This test should be failing and is not.
# If I did not test manually I would'nt know !
pass
But maybe there is a better, more generic solution that apply for eveything at once ?
I have an error in my template : I included another template and the link is broken. If I manually check with DEBUG=True I get a TemplateDoesNotExist error. But during my test case the url is rendered without the broken include, it does not throw an error, and the http_status is 200. I already tested the very generic included template somewhere else, so I don't want to add test to see if what is inside was rendered correctly. But I want to see rendering fails, that's what my test are for !
I tried to set TEMPLATE_STRING_IF_INVALID to an Exception (found here), but it does not seem to be working for a broken include.
Is there a way to make all rendering error raise en exception during tests, without breaking the django's design principle of not running test in debug ?