mirror of
https://github.com/pacnpal/django-anymail.git
synced 2025-12-20 20:01:05 -05:00
Deprecate DjrillAdminSite
This commit is contained in:
@@ -1,9 +1,11 @@
|
||||
import re
|
||||
import six
|
||||
import sys
|
||||
|
||||
__all__ = (
|
||||
'BackportedAssertions',
|
||||
'override_settings',
|
||||
'reset_warning_registry',
|
||||
)
|
||||
|
||||
try:
|
||||
@@ -86,3 +88,18 @@ class BackportedAssertions(object):
|
||||
callable_obj=None, *args, **kwargs):
|
||||
return six.assertRaisesRegex(self, expected_exception, re.escape(expected_message),
|
||||
callable_obj, *args, **kwargs)
|
||||
|
||||
|
||||
# Backport from Django 1.8 (django.test.utils)
|
||||
def reset_warning_registry():
|
||||
"""
|
||||
Clear warning registry for all modules. This is required in some tests
|
||||
because of a bug in Python that prevents warnings.simplefilter("always")
|
||||
from always making warnings appear: http://bugs.python.org/issue4180
|
||||
|
||||
The bug was fixed in Python 3.4.2.
|
||||
"""
|
||||
key = "__warningregistry__"
|
||||
for mod in sys.modules.values():
|
||||
if hasattr(mod, key):
|
||||
getattr(mod, key).clear()
|
||||
|
||||
Reference in New Issue
Block a user