Index: django/contrib/messages/tests/cookie.py
===================================================================
--- django/contrib/messages/tests/cookie.py	(révision 16579)
+++ django/contrib/messages/tests/cookie.py	(copie de travail)
@@ -3,6 +3,7 @@
 from django.contrib.messages.storage.cookie import (CookieStorage,
     MessageEncoder, MessageDecoder)
 from django.contrib.messages.storage.base import Message
+from django.test.utils import override_settings
 from django.utils import simplejson as json
 from django.conf import settings
 
@@ -41,15 +42,6 @@
 class CookieTest(BaseTest):
     storage_class = CookieStorage
 
-    def setUp(self):
-        super(CookieTest, self).setUp()
-        self.old_SESSION_COOKIE_DOMAIN = settings.SESSION_COOKIE_DOMAIN
-        settings.SESSION_COOKIE_DOMAIN = '.lawrence.com'
-
-    def tearDown(self):
-        super(CookieTest, self).tearDown()
-        settings.SESSION_COOKIE_DOMAIN = self.old_SESSION_COOKIE_DOMAIN
-
     def stored_messages_count(self, storage, response):
         return stored_cookie_messages_count(storage, response)
 
@@ -139,3 +131,7 @@
         value = encoder.encode(messages)
         decoded_messages = json.loads(value, cls=MessageDecoder)
         self.assertEqual(messages, decoded_messages)
+
+
+CookieTest = override_settings(
+        SESSION_COOKIE_DOMAIN='.lawrence.com')(CookieTest)
Index: django/contrib/messages/tests/base.py
===================================================================
--- django/contrib/messages/tests/base.py	(révision 16579)
+++ django/contrib/messages/tests/base.py	(copie de travail)
@@ -1,5 +1,6 @@
 from django import http
 from django.test import TestCase
+from django.test.utils import override_settings
 from django.conf import settings
 from django.utils.translation import ugettext_lazy
 from django.utils.unittest import skipIf
@@ -31,7 +32,6 @@
 
 class BaseTest(TestCase):
     storage_class = default_storage
-    restore_settings = ['MESSAGE_LEVEL', 'MESSAGE_TAGS']
     urls = 'django.contrib.messages.tests.urls'
     levels = {
         'debug': constants.DEBUG,
@@ -42,12 +42,6 @@
     }
 
     def setUp(self):
-        self._remembered_settings = {}
-        for setting in self.restore_settings:
-            if hasattr(settings, setting):
-                self._remembered_settings[setting] = getattr(settings, setting)
-                delattr(settings._wrapped, setting)
-        # Backup these manually because we do not want them deleted.
         self._middleware_classes = settings.MIDDLEWARE_CLASSES
         self._template_context_processors = \
            settings.TEMPLATE_CONTEXT_PROCESSORS
@@ -55,27 +49,14 @@
         self._message_storage = settings.MESSAGE_STORAGE
         settings.MESSAGE_STORAGE = '%s.%s' % (self.storage_class.__module__,
                                               self.storage_class.__name__)
-        self.old_TEMPLATE_DIRS = settings.TEMPLATE_DIRS
-        settings.TEMPLATE_DIRS = ()
 
     def tearDown(self):
-        for setting in self.restore_settings:
-            self.restore_setting(setting)
-        # Restore these manually (see above).
         settings.MIDDLEWARE_CLASSES = self._middleware_classes
         settings.TEMPLATE_CONTEXT_PROCESSORS = \
            self._template_context_processors
         settings.INSTALLED_APPS = self._installed_apps
         settings.MESSAGE_STORAGE = self._message_storage
-        settings.TEMPLATE_DIRS = self.old_TEMPLATE_DIRS
 
-    def restore_setting(self, setting):
-        if setting in self._remembered_settings:
-            value = self._remembered_settings.pop(setting)
-            setattr(settings, setting, value)
-        elif hasattr(settings, setting):
-            delattr(settings._wrapped, setting)
-
     def get_request(self):
         return http.HttpRequest()
 
@@ -390,5 +371,14 @@
                          ['info', 'custom', 'extra-tag', '', 'bad', 'success'])
         finally:
             # Ensure the level tags constant is put back like we found it.
-            self.restore_setting('MESSAGE_TAGS')
+            settings.MESSAGE_TAGS = {}
             base.LEVEL_TAGS = utils.get_level_tags()
+
+
+BaseTest = override_settings(
+        DEBUG_PROPAGATE_EXCEPTIONS=True,
+        # this is the default value, see storage.base.BaseStorage._get_level()
+        MESSAGE_LEVEL=constants.INFO,
+        # this is the default value, see utils.get_level_tags()
+        MESSAGE_TAGS={},
+        TEMPLATE_DIRS=())(BaseTest)
