Display deprecation warnings for a specific version only when testing Django

I am going to upgrade from Django 1.9 to 1.10 and want to check if I have some deprecated features.

However using

python -Wall manage.py test

tons and tons of alerts for Django 2.0 will be displayed. Is there a way to suppress warnings only for version 2.0 or show only warnings for 1.10?

+4
source share
2 answers

Add this to your manage.py:

import warnings
from django.utils.deprecation import RemovedInDjango110Warning

warnings.filterwarnings('always', category=RemovedInDjango110Warning)

Change "always" to "default" to ignore redundant messages or "error" to cause the program to crash on warning.

+3
source

:

python -Wd manage.py check

python -Wd manage.py test
0

Source: https://habr.com/ru/post/1666528/


All Articles