Ticket #13660: django-template-tests.diff

File django-template-tests.diff, 1.5 KB (added by Alex Gaynor, 14 years ago)
  • tests/regressiontests/templates/loaders.py

    diff --git a/tests/regressiontests/templates/loaders.py b/tests/regressiontests/templates/loaders.py
    index 64a0dc6..dfe1e3e 100644
    a b from django.template import TemplateDoesNotExist, Context  
    2020from django.template.loaders.eggs import load_template_source as lts_egg
    2121from django.template import loader
    2222
     23
    2324# Mock classes and objects for pkg_resources functions.
    2425class MockProvider(pkg_resources.NullProvider):
    2526    def __init__(self, module):
    class CachedLoader(unittest.TestCase):  
    99100                )
    100101            ),
    101102        )
     103        # Empty the cache
     104        loader.template_source_loaders = None
     105       
    102106    def tearDown(self):
    103107        settings.TEMPLATE_LOADERS = self.old_TEMPLATE_LOADERS
     108        # Empty the cache
     109        loader.template_source_loaders = None
    104110
    105111    def test_templatedir_caching(self):
    106112        "Check that the template directories form part of the template cache key. Refs #13573"
    class CachedLoader(unittest.TestCase):  
    108114        t1, name = loader.find_template('test.html', (os.path.join(os.path.dirname(__file__), 'templates', 'first'),))
    109115        # Now retrieve the same template name, but from a different directory
    110116        t2, name = loader.find_template('test.html', (os.path.join(os.path.dirname(__file__), 'templates', 'second'),))
    111 
    112117        # The two templates should not have the same content
    113118        self.assertNotEqual(t1.render(Context({})), t2.render(Context({})))
    114119
Back to Top