Preparing for 2.2LTS - testing for Deprecation Warnings

29 views
Skip to first unread message

Dan Davis

unread,
Jan 17, 2019, 11:23:50 AM1/17/19
to Django users
PYTHONWARNINGS=error is too much.

How can I call warnings.filterwarnings() to make all *Django* DeprecationWarnings into errors?

Simon Charette

unread,
Jan 17, 2019, 1:07:35 PM1/17/19
to Django users
You can use the category kwarg of filterwarnings[0] to pass the Django deprecation
warning classes.

They can be found in the django.utils.deprecation module. (e.g. RemovedInDjango30Warning).

Cheers,
Simon

Dan Davis

unread,
Jan 17, 2019, 8:13:44 PM1/17/19
to django...@googlegroups.com

I will then try like this in my manage.py:

     if len(sys.argv)>1 and sys.argv[1] = 'test':
          warnings.filterwarnings(...)

Thanks,

-Dan

--
You received this message because you are subscribed to a topic in the Google Groups "Django users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/django-users/Urrwf66qv6A/unsubscribe.
To unsubscribe from this group and all its topics, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/520cea1a-7df7-4060-a8b0-3d361473e7a5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages