Skip to content

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

Merged
merged 1 commit into from
Oct 10, 2020

Conversation

adamchainz
Copy link
Contributor

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.

@adamchainz
Copy link
Contributor Author

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.

@smithdc1
Copy link
Contributor

smithdc1 commented Oct 9, 2020

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.
@adamchainz adamchainz force-pushed the deprecation_warnings branch from 68c90c4 to 96546cc Compare October 9, 2020 11:22
@@ -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}
Copy link
Contributor Author

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.

@adamchainz adamchainz merged commit 563b043 into encode:master Oct 10, 2020
@adamchainz adamchainz deleted the deprecation_warnings branch October 10, 2020 16:34
adamchainz added a commit to adamchainz/django-import-export that referenced this pull request Oct 16, 2020
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.
andrewgy8 pushed a commit to django-import-export/django-import-export that referenced this pull request Oct 19, 2020
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.
ZuluPro pushed a commit to ZuluPro/django-import-export that referenced this pull request Dec 23, 2020
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.
sigvef pushed a commit to sigvef/django-rest-framework that referenced this pull request Dec 3, 2022
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants