Ticket #17948: django-tests-loader.patch

File django-tests-loader.patch, 1.4 KB (added by andrey@…, 7 years ago)
  • django/contrib/auth/tests/views.py

    diff --git a/django/contrib/auth/tests/views.py b/django/contrib/auth/tests/views.py
    index 1975266..2ffa8d5 100644
    a b from django.core.urlresolvers import reverse, NoReverseMatch 
    1111from django.http import QueryDict
    1212from django.utils.encoding import force_unicode
    1313from django.utils.html import escape
     14from django.template import loader
    1415from django.test import TestCase
    1516
    1617from django.contrib.auth import SESSION_KEY, REDIRECT_FIELD_NAME
    class AuthViewsTestCase(TestCase): 
    3435        settings.TEMPLATE_DIRS = (
    3536            os.path.join(os.path.dirname(__file__), 'templates'),
    3637        )
     38        self.old_TEMPLATE_LOADERS = settings.TEMPLATE_LOADERS
     39        settings.TEMPLATE_LOADERS = ('django.template.loaders.filesystem.Loader',
     40                                     'django.template.loaders.app_directories.Loader')
     41        loader.template_source_loaders = None #Flushing loader cache
    3742
    3843    def tearDown(self):
    3944        settings.LANGUAGES = self.old_LANGUAGES
    4045        settings.LANGUAGE_CODE = self.old_LANGUAGE_CODE
    4146        settings.TEMPLATE_DIRS = self.old_TEMPLATE_DIRS
     47        settings.TEMPLATE_LOADERS = self.old_TEMPLATE_LOADERS
     48        loader.template_source_loaders = None #Flushing loader cache
    4249
    4350    def login(self, password='password'):
    4451        response = self.client.post('/login/', {
Back to Top