Hi all,

I got really frustrated today trying to understand why a bug could get past
my test suite but fail in my dev environment. Finally Baptiste Mispelon
pointed me to the include template tag documentation
<https://docs.djangoproject.com/en/1.9/ref/templates/builtins/#include>:

If the included template causes an exception while it’s rendered (including
> if it’s missing or has syntax errors), the behavior varies depending on the
> template engine's debug option (if not set, this option defaults to the
> value of DEBUG). When debug mode is turned on, an exception like
> TemplateDoesNotExist or TemplateSyntaxError will be raised. When debug mode
> is turned off, {% include %} logs a warning to the django.template logger
> with the exception that happens while rendering the included template and
> returns an empty string.
>

That's a real problem when running tests, because since the exception is
just silenced your tests will still pass although there was actually some
error in your code. The current way to deal with this is, I guess, to set
the template engine DEBUG option to True in the test environment but that
doesn't seem right to me.

I don't have a solution right now and I know this would be a big backwards
incompatible change and the chances for this to change are abysmally low.
But maybe we could just add an option for that (to make exceptions pop out
of the include tag), set its default value to match the current behaviour,
and change it with a clear deprecation plan?

Cheers,
Sylvain

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/CAAXOc46M7jbPtF2rBZsOjod-Wm%2BatCtbpuTaFE%2BFgxhc4gSqCw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to