Skip to content

Commit

Permalink
Merge branch 'feature/cached-loader' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
Fantomas42 committed Dec 1, 2014
2 parents a414b73 + 4d0274d commit 82b733c
Showing 1 changed file with 32 additions and 1 deletion.
33 changes: 32 additions & 1 deletion app_namespace/tests/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from django.template.base import Template
from django.template.base import TemplateDoesNotExist
from django.template.loaders import app_directories
from django.test.utils import override_settings

from app_namespace import Loader

Expand Down Expand Up @@ -76,6 +77,12 @@ def test_load_template_source_dotted_namespace(self):
self.assertEquals(template_short[0], template_dotted[0])


@override_settings(
TEMPLATE_LOADERS=(
'app_namespace.Loader',
'django.template.loaders.app_directories.Loader',
)
)
class TemplateTestCase(TestCase):
maxDiff = None

Expand Down Expand Up @@ -217,10 +224,12 @@ def setUp(self):

def tearDown(self):
sys.path.remove(self.app_directory)
for app in self.apps:
del sys.modules[app]
shutil.rmtree(self.app_directory)
settings.INSTALLED_APPS = self.original_installed_apps

def test_multiple_extend_empty_namespace(self):
def multiple_extend_empty_namespace(self):
context = Context({})
template = Template(
self.template_extend % {'app': 'top-level'}
Expand All @@ -232,3 +241,25 @@ def test_multiple_extend_empty_namespace(self):
self.assertTrue(template.index(test_app) >
template.index(previous_app))
previous_app = test_app

@override_settings(
TEMPLATE_LOADERS=(
'app_namespace.Loader',
'django.template.loaders.app_directories.Loader',
)
)
def test_multiple_extend_empty_namespace(self):
self.multiple_extend_empty_namespace()

@override_settings(
TEMPLATE_LOADERS=(
('django.template.loaders.cached.Loader', (
'app_namespace.Loader',
'django.template.loaders.app_directories.Loader',
)
),
)
)
def test_cached_multiple_extend_empty_namespace(self):
with self.assertRaises(RuntimeError):
self.multiple_extend_empty_namespace()

0 comments on commit 82b733c

Please sign in to comment.