-
-
Notifications
You must be signed in to change notification settings - Fork 6.9k
Error on deprecation and pending deprecation warnings #7586
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
I've applied this to all my individually maintained open projects recently and it's worked really well to prevent this annoyance. It took a while to merge the fixes for Django 3.1 deprecation warnings in DRF, such as #7513 - this is my motivation for catching them earlier. |
LGTM -- Looks like the failure here would be fixed by #7531 |
Erroring on deprecation or pending deprecation warnings means they are caught early. This will avoid the cycle of releasing with 'support for Django X', then chasing all the deprecation warnings one-by-one. Instead, when a new Django version is added to the test matrix, it will fail until all the relevant warnings are fixed. This avoids passing these warnings on to users, some of whom don't upgrade until they are all fixed.
68c90c4
to
96546cc
Compare
@@ -14,7 +14,7 @@ DJANGO = | |||
master: djangomaster | |||
|
|||
[testenv] | |||
commands = ./runtests.py --fast --coverage {posargs} | |||
commands = python -W error::DeprecationWarning -W error::PendingDeprecationWarning runtests.py --fast --coverage {posargs} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Btw the reason to do this with python -W
rather than through e.g. pytest's warning system is to catch any import-time warnings that happen before pytest even starts running.
This is a technique I've rolled out against my own open source projects and [Django REST Framework](encode/django-rest-framework#7586). By failing tests as soon as new deprecation warnings are created in the library, they aren't passed on to users who then have to report them back in issues like django-import-export#1195, saving everyone some time, effort, and noise.
This is a technique I've rolled out against my own open source projects and [Django REST Framework](encode/django-rest-framework#7586). By failing tests as soon as new deprecation warnings are created in the library, they aren't passed on to users who then have to report them back in issues like #1195, saving everyone some time, effort, and noise.
This is a technique I've rolled out against my own open source projects and [Django REST Framework](encode/django-rest-framework#7586). By failing tests as soon as new deprecation warnings are created in the library, they aren't passed on to users who then have to report them back in issues like django-import-export#1195, saving everyone some time, effort, and noise.
Erroring on deprecation or pending deprecation warnings means they are caught early. This will avoid the cycle of releasing with 'support for Django X', then chasing all the deprecation warnings one-by-one. Instead, when a new Django version is added to the test matrix, it will fail until all the relevant warnings are fixed. This avoids passing these warnings on to users, some of whom don't upgrade until they are all fixed.
Description
Erroring on deprecation or pending deprecation warnings means they are caught early. This will avoid the cycle of releasing with 'support for Django X', then chasing all the deprecation warnings one-by-one. Instead, when a new Django version is added to the test matrix, it will fail until all the relevant warnings are fixed. This avoids passing these warnings on to users, some of whom don't upgrade until they are all fixed.