Code

Ticket #13660: django-template-tests.diff

File django-template-tests.diff, 1.5 KB (added by Alex, 4 years ago)
Line 
1diff --git a/tests/regressiontests/templates/loaders.py b/tests/regressiontests/templates/loaders.py
2index 64a0dc6..dfe1e3e 100644
3--- a/tests/regressiontests/templates/loaders.py
4+++ b/tests/regressiontests/templates/loaders.py
5@@ -20,6 +20,7 @@ from django.template import TemplateDoesNotExist, Context
6 from django.template.loaders.eggs import load_template_source as lts_egg
7 from django.template import loader
8 
9+
10 # Mock classes and objects for pkg_resources functions.
11 class MockProvider(pkg_resources.NullProvider):
12     def __init__(self, module):
13@@ -99,8 +100,13 @@ class CachedLoader(unittest.TestCase):
14                 )
15             ),
16         )
17+        # Empty the cache
18+        loader.template_source_loaders = None
19+       
20     def tearDown(self):
21         settings.TEMPLATE_LOADERS = self.old_TEMPLATE_LOADERS
22+        # Empty the cache
23+        loader.template_source_loaders = None
24 
25     def test_templatedir_caching(self):
26         "Check that the template directories form part of the template cache key. Refs #13573"
27@@ -108,7 +114,6 @@ class CachedLoader(unittest.TestCase):
28         t1, name = loader.find_template('test.html', (os.path.join(os.path.dirname(__file__), 'templates', 'first'),))
29         # Now retrieve the same template name, but from a different directory
30         t2, name = loader.find_template('test.html', (os.path.join(os.path.dirname(__file__), 'templates', 'second'),))
31-
32         # The two templates should not have the same content
33         self.assertNotEqual(t1.render(Context({})), t2.render(Context({})))
34