'Tests that the correct template is identified as not existing
when {% include %} specifies a template that does not exist.'

def test_include_missing_template(self):

    (old_td, settings.TEMPLATE_DEBUG) = (settings.TEMPLATE_DEBUG, True)
    old_loaders = loader.template_source_loaders
    try:
        loader.template_source_loaders = (app_directories.Loader(),)
        load_name = 'test_include_error.html'
        r = None
        try:
            tmpl = loader.select_template([load_name])
            r = tmpl.render(template.Context({}))
        except template.TemplateDoesNotExist as e:
            settings.TEMPLATE_DEBUG = old_td
            self.assertEqual(e.args[0], 'missing.html')
        self.assertEqual(r, None, ('Template    rendering    unexpectedly    succeeded,    produced:    ->%r<-' % r))
    finally:
        loader.template_source_loaders = old_loaders
        settings.TEMPLATE_DEBUG = old_td
