Code

Ticket #16507: 16507.diff

File 16507.diff, 1.5 KB (added by aaugustin, 3 years ago)
Line 
1Index: django/contrib/messages/tests/base.py
2===================================================================
3--- django/contrib/messages/tests/base.py       (révision 16579)
4+++ django/contrib/messages/tests/base.py       (copie de travail)
5@@ -1,5 +1,6 @@
6 from django import http
7 from django.test import TestCase
8+from django.test.utils import override_settings
9 from django.conf import settings
10 from django.utils.translation import ugettext_lazy
11 from django.utils.unittest import skipIf
12@@ -55,8 +56,6 @@
13         self._message_storage = settings.MESSAGE_STORAGE
14         settings.MESSAGE_STORAGE = '%s.%s' % (self.storage_class.__module__,
15                                               self.storage_class.__name__)
16-        self.old_TEMPLATE_DIRS = settings.TEMPLATE_DIRS
17-        settings.TEMPLATE_DIRS = ()
18 
19     def tearDown(self):
20         for setting in self.restore_settings:
21@@ -67,7 +66,6 @@
22            self._template_context_processors
23         settings.INSTALLED_APPS = self._installed_apps
24         settings.MESSAGE_STORAGE = self._message_storage
25-        settings.TEMPLATE_DIRS = self.old_TEMPLATE_DIRS
26 
27     def restore_setting(self, setting):
28         if setting in self._remembered_settings:
29@@ -392,3 +390,7 @@
30             # Ensure the level tags constant is put back like we found it.
31             self.restore_setting('MESSAGE_TAGS')
32             base.LEVEL_TAGS = utils.get_level_tags()
33+
34+
35+BaseTest = override_settings(DEBUG_PROPAGATE_EXCEPTIONS=True,
36+                             TEMPLATE_DIRS=())(BaseTest)