mirror of
https://github.com/django/django.git
synced 2025-10-24 06:06:09 +00:00
Stopped iterating on INSTALLED_APPS.
Used the app cache's get_app_configs() method instead.
This commit is contained in:
@@ -16,6 +16,7 @@ import unittest
|
||||
import warnings
|
||||
|
||||
from django import template
|
||||
from django.core.apps import app_cache
|
||||
from django.core import urlresolvers
|
||||
from django.template import (base as template_base, loader, Context,
|
||||
RequestContext, Template, TemplateSyntaxError)
|
||||
@@ -1873,24 +1874,26 @@ class TemplateTagLoading(TestCase):
|
||||
self.assertTrue('ImportError' in e.args[0])
|
||||
self.assertTrue('Xtemplate' in e.args[0])
|
||||
|
||||
@override_settings(INSTALLED_APPS=('tagsegg',))
|
||||
def test_load_error_egg(self):
|
||||
ttext = "{% load broken_egg %}"
|
||||
egg_name = '%s/tagsegg.egg' % self.egg_dir
|
||||
sys.path.append(egg_name)
|
||||
self.assertRaises(template.TemplateSyntaxError, template.Template, ttext)
|
||||
with self.assertRaises(template.TemplateSyntaxError):
|
||||
with app_cache._with_app('tagsegg'):
|
||||
template.Template(ttext)
|
||||
try:
|
||||
template.Template(ttext)
|
||||
with app_cache._with_app('tagsegg'):
|
||||
template.Template(ttext)
|
||||
except template.TemplateSyntaxError as e:
|
||||
self.assertTrue('ImportError' in e.args[0])
|
||||
self.assertTrue('Xtemplate' in e.args[0])
|
||||
|
||||
@override_settings(INSTALLED_APPS=('tagsegg',))
|
||||
def test_load_working_egg(self):
|
||||
ttext = "{% load working_egg %}"
|
||||
egg_name = '%s/tagsegg.egg' % self.egg_dir
|
||||
sys.path.append(egg_name)
|
||||
template.Template(ttext)
|
||||
with app_cache._with_app('tagsegg'):
|
||||
template.Template(ttext)
|
||||
|
||||
|
||||
class RequestContextTests(unittest.TestCase):
|
||||
|
||||
Reference in New Issue
Block a user