mirror of
https://github.com/django/django.git
synced 2025-10-24 06:06:09 +00:00
Prevented calling setup() inside catch_warnings
When django.setup() (and then configure_logging) is called inside catch_warnings, logging setup is negatively affected (notably warnings.showwarning definition).
This commit is contained in:
@@ -125,10 +125,13 @@ def setup(verbosity, test_labels):
|
||||
handler = logging.StreamHandler()
|
||||
logger.addHandler(handler)
|
||||
|
||||
warnings.filterwarnings(
|
||||
'ignore',
|
||||
'django.contrib.comments is deprecated and will be removed before Django 1.8.',
|
||||
DeprecationWarning
|
||||
)
|
||||
# Load all the ALWAYS_INSTALLED_APPS.
|
||||
with warnings.catch_warnings():
|
||||
warnings.filterwarnings('ignore', 'django.contrib.comments is deprecated and will be removed before Django 1.8.', DeprecationWarning)
|
||||
django.setup()
|
||||
django.setup()
|
||||
|
||||
# Load all the test model apps.
|
||||
test_modules = get_test_modules()
|
||||
|
||||
Reference in New Issue
Block a user