From c7f44ae085df3a270aa998cdedb56f36900cb9ef Mon Sep 17 00:00:00 2001 From: Claude Paroz Date: Sat, 15 Sep 2012 21:39:08 +0200 Subject: [PATCH] Fixed #17948 -- Isolated auth tests from custom template loaders Thanks andrey@kostenko.name for the report. --- django/contrib/auth/tests/views.py | 5 +++-- django/test/signals.py | 7 +++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/django/contrib/auth/tests/views.py b/django/contrib/auth/tests/views.py index 3c847f456a..e3402b13b9 100644 --- a/django/contrib/auth/tests/views.py +++ b/django/contrib/auth/tests/views.py @@ -1,7 +1,7 @@ import os import re -from django.conf import settings +from django.conf import global_settings, settings from django.contrib.sites.models import Site, RequestSite from django.contrib.auth.models import User from django.core import mail @@ -23,7 +23,8 @@ from django.contrib.auth.forms import (AuthenticationForm, PasswordChangeForm, ('en', 'English'), ), LANGUAGE_CODE='en', - TEMPLATE_DIRS = ( + TEMPLATE_LOADERS=global_settings.TEMPLATE_LOADERS, + TEMPLATE_DIRS=( os.path.join(os.path.dirname(__file__), 'templates'), ), USE_TZ=False, diff --git a/django/test/signals.py b/django/test/signals.py index 5b0a9a19ca..d140304f1d 100644 --- a/django/test/signals.py +++ b/django/test/signals.py @@ -51,6 +51,13 @@ def clear_context_processors_cache(**kwargs): context._standard_context_processors = None +@receiver(setting_changed) +def clear_template_loaders_cache(**kwargs): + if kwargs['setting'] == 'TEMPLATE_LOADERS': + from django.template import loader + loader.template_source_loaders = None + + @receiver(setting_changed) def clear_serializers_cache(**kwargs): if kwargs['setting'] == 'SERIALIZATION_MODULES':