1
0
mirror of https://github.com/django/django.git synced 2025-10-23 21:59:11 +00:00

Fixed #18042 -- Advanced deprecation warnings.

Thanks Ramiro for the patch.
This commit is contained in:
Aymeric Augustin
2012-05-03 15:27:01 +02:00
parent 227cec686e
commit e84f79f051
27 changed files with 75 additions and 38 deletions

View File

@@ -1,9 +1,10 @@
import copy
import warnings
from django.conf import compat_patch_logging_config
from django.core import mail
from django.test import TestCase, RequestFactory
from django.test.utils import override_settings
from django.test.utils import override_settings, get_warnings_state, restore_warnings_state
from django.utils.log import CallbackFilter, RequireDebugFalse, getLogger
@@ -40,7 +41,13 @@ class PatchLoggingConfigTest(TestCase):
"""
config = copy.deepcopy(OLD_LOGGING)
compat_patch_logging_config(config)
warnings_state = get_warnings_state()
warnings.filterwarnings('ignore', category=DeprecationWarning, module='django.conf')
try:
compat_patch_logging_config(config)
finally:
restore_warnings_state(warnings_state)
self.assertEqual(
config["handlers"]["mail_admins"]["filters"],