I know that django test cases are executed using 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):
But maybe there is a better, more general solution that applies immediately to eveything?
I have an error in my template: I have included another template and the link is not working. If I manually check with DEBUG = True, I get a TemplateDoesNotExist error. But during my test, the url is displayed without a broken include, it does not throw an error, and http_status is 200. I already tested the template with general shared inclusion elsewhere, so I donβt want to add a test to see what is inside was displayed right. But I want the rendering to fail, for which my test is!
I tried setting TEMPLATE_STRING_IF_INVALID to Exception (found here ), but it doesn't seem to work for a broken include.
Is there a way to make all the rendering errors raise raise an exception during tests without violating the django design principle, which does not trigger validation during debugging?
source share