[Django] #37080: Django's own tests should always treat both Django deprecation warnings as errors

35 views
Skip to first unread message

Django

unread,
May 1, 2026, 1:56:22 PMMay 1
to django-...@googlegroups.com
#37080: Django's own tests should always treat both Django deprecation warnings as
errors
-------------------------------------+-------------------------------------
Reporter: Mike Edmunds | Type:
| Cleanup/optimization
Status: new | Component: Testing
| framework
Version: dev | Severity: Normal
Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Django's runtests.py treats RemovedAfterNextVersionWarning (currently
equivalent to RemovedInDjango70Warning) as an error, in all releases. And
in x.0 and x.2 releases, it also treats RemovedInNextVersionWarning as an
error.

However, in x.1 releases RemovedInNextVersionWarning is ''not'' handled as
an error (because there is no RemovedInDjango62Warning, or any x.2
equivalent).

This doesn't matter for most Django tests, which use the concrete
RemovedInDjango70Warning, RemovedInDjango71Warning, etc. But it
complicates testing Django's own deprecation utilities and assertion
helpers, and it [https://code.djangoproject.com/ticket/37072#comment:8
makes discussions of them complicated].

Suggestion: change runtests.py to use the ''generic'' warnings and treat
them ''both'' as errors—always, without the need to advance them each
release:

{{{#!python
# Before:
warnings.simplefilter("error", RemovedInDjango70Warning)

# After
warnings.simplefilter("error", RemovedInNextVersionWarning)
warnings.simplefilter("error", RemovedAfterNextVersionWarning)
}}}


(I think this becomes moot if/when we switch to calendar cycle releases.)
--
Ticket URL: <https://code.djangoproject.com/ticket/37080>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
May 1, 2026, 5:01:52 PMMay 1
to django-...@googlegroups.com
#37080: Django's own tests should always treat both Django deprecation warnings as
errors
--------------------------------------+------------------------------------
Reporter: Mike Edmunds | Owner: (none)
Type: Cleanup/optimization | Status: new
Component: Testing framework | Version: dev
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by Jacob Walls):

* stage: Unreviewed => Accepted

Comment:

Thanks, I can see how this makes testing the assertions themselves more
difficult. (I'll leave Testing Framework as the component in that case.)

> (I think this becomes moot if/when we switch to calendar cycle
releases.)

Can you expand on that part? I'm assuming that part wouldn't change.
--
Ticket URL: <https://code.djangoproject.com/ticket/37080#comment:1>

Django

unread,
May 1, 2026, 5:55:42 PMMay 1
to django-...@googlegroups.com
#37080: Django's own tests should always treat both Django deprecation warnings as
errors
--------------------------------------+------------------------------------
Reporter: Mike Edmunds | Owner: (none)
Type: Cleanup/optimization | Status: new
Component: Testing framework | Version: dev
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------
Comment (by Mike Edmunds):

Replying to [comment:1 Jacob Walls]:
> > (I think this becomes moot if/when we switch to calendar cycle
releases.)
>
> Can you expand on that part? I'm assuming that part wouldn't change.

The [https://github.com/carltongibson/django-
deps/blob/8693ccc8b949a5cfca1d523f2addd6716464ef8b/draft/0020-annual-
release-cycle.rst#deprecation-policy DEP 20 deprecation policy] doesn't
have the X.0 special cases that result in RemovedInDjango62Warning not
existing, so being omitted from the runtests.py filters. There will always
be two concrete RemovedIn warnings defined…

{{{#!python
# Django 2028.x:
# RemovedInNextVersionWarning (DeprecationWarning):
warnings.simplefilter("error", RemovedInDjango2029Warning)
# RemovedAfterNextVersionWarning (PendingDeprecationWarning):
warnings.simplefilter("error", RemovedInDjango2030Warning)
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/37080#comment:2>

Django

unread,
May 1, 2026, 5:57:18 PMMay 1
to django-...@googlegroups.com
#37080: Django's own tests should always treat both Django deprecation warnings as
errors
--------------------------------------+------------------------------------
Reporter: Mike Edmunds | Owner: (none)
Type: Cleanup/optimization | Status: new
Component: Testing framework | Version: dev
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by Mike Edmunds):

* easy: 0 => 1

--
Ticket URL: <https://code.djangoproject.com/ticket/37080#comment:3>

Django

unread,
May 1, 2026, 7:10:07 PMMay 1
to django-...@googlegroups.com
#37080: Django's own tests should always treat both Django deprecation warnings as
errors
--------------------------------------+------------------------------------
Reporter: Mike Edmunds | Owner: (none)
Type: Cleanup/optimization | Status: new
Component: Testing framework | Version: dev
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
--------------------------------------+------------------------------------
Comment (by Héctor Castillo):

Hi, I’d like to work on this issue.
--
Ticket URL: <https://code.djangoproject.com/ticket/37080#comment:4>

Django

unread,
May 1, 2026, 7:17:29 PMMay 1
to django-...@googlegroups.com
#37080: Django's own tests should always treat both Django deprecation warnings as
errors
--------------------------------------+------------------------------------
Reporter: Mike Edmunds | Owner: (none)
Type: Cleanup/optimization | Status: new
Component: Testing framework | Version: dev
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
--------------------------------------+------------------------------------
Comment (by Mike Edmunds):

Welcome Héctor. Please follow
[https://docs.djangoproject.com/en/dev/internals/contributing/writing-
code/ Django's contributor docs] starting with
[https://docs.djangoproject.com/en/dev/internals/contributing/writing-code
/submitting-patches/#claiming-tickets "Claiming" tickets].
--
Ticket URL: <https://code.djangoproject.com/ticket/37080#comment:5>

Django

unread,
May 1, 2026, 7:44:59 PMMay 1
to django-...@googlegroups.com
#37080: Django's own tests should always treat both Django deprecation warnings as
errors
-------------------------------------+-------------------------------------
Reporter: Mike Edmunds | Owner: Héctor
Type: | Castillo
Cleanup/optimization | Status: assigned
Component: Testing framework | Version: dev
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Héctor Castillo):

* owner: (none) => Héctor Castillo
* status: new => assigned

--
Ticket URL: <https://code.djangoproject.com/ticket/37080#comment:6>

Django

unread,
May 1, 2026, 8:55:56 PMMay 1
to django-...@googlegroups.com
#37080: Django's own tests should always treat both Django deprecation warnings as
errors
-------------------------------------+-------------------------------------
Reporter: Mike Edmunds | Owner: Héctor
Type: | Castillo
Cleanup/optimization | Status: assigned
Component: Testing framework | Version: dev
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Héctor Castillo):

* has_patch: 0 => 1

--
Ticket URL: <https://code.djangoproject.com/ticket/37080#comment:7>

Django

unread,
May 1, 2026, 11:28:24 PMMay 1
to django-...@googlegroups.com
#37080: Django's own tests should always treat both Django deprecation warnings as
errors
-------------------------------------+-------------------------------------
Reporter: Mike Edmunds | Owner: Héctor
Type: | Castillo
Cleanup/optimization | Status: assigned
Component: Testing framework | Version: dev
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by Héctor Castillo):

PR submitted: ​https://github.com/django/django/pull/21216
--
Ticket URL: <https://code.djangoproject.com/ticket/37080#comment:8>

Django

unread,
May 2, 2026, 11:38:28 AMMay 2
to django-...@googlegroups.com
#37080: Django's own tests should always treat both Django deprecation warnings as
errors
-------------------------------------+-------------------------------------
Reporter: Mike Edmunds | Owner: Héctor
Type: | Castillo
Cleanup/optimization | Status: assigned
Component: Testing framework | Version: dev
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mike Edmunds):

* needs_better_patch: 0 => 1

--
Ticket URL: <https://code.djangoproject.com/ticket/37080#comment:9>

Django

unread,
May 2, 2026, 4:15:15 PMMay 2
to django-...@googlegroups.com
#37080: Django's own tests should always treat both Django deprecation warnings as
errors
-------------------------------------+-------------------------------------
Reporter: Mike Edmunds | Owner: Héctor
Type: | Castillo
Cleanup/optimization | Status: assigned
Component: Testing framework | Version: dev
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Héctor Castillo):

* needs_better_patch: 1 => 0

--
Ticket URL: <https://code.djangoproject.com/ticket/37080#comment:10>

Django

unread,
May 4, 2026, 12:52:48 PMMay 4
to django-...@googlegroups.com
#37080: Django's own tests should always treat both Django deprecation warnings as
errors
-------------------------------------+-------------------------------------
Reporter: Mike Edmunds | Owner: Héctor
Type: | Castillo
Cleanup/optimization | Status: assigned
Component: Testing framework | Version: dev
Severity: Normal | Resolution:
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mike Edmunds):

* stage: Accepted => Ready for checkin

--
Ticket URL: <https://code.djangoproject.com/ticket/37080#comment:11>

Django

unread,
May 4, 2026, 1:54:00 PMMay 4
to django-...@googlegroups.com
#37080: Django's own tests should always treat both Django deprecation warnings as
errors
-------------------------------------+-------------------------------------
Reporter: Mike Edmunds | Owner: Héctor
Type: | Castillo
Cleanup/optimization | Status: closed
Component: Testing framework | Version: dev
Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Jacob Walls <jacobtylerwalls@…>):

* resolution: => fixed
* status: assigned => closed

Comment:

In [changeset:"f8c0a9321f07c4bbb338da59d57c38878c85d1f0" f8c0a93]:
{{{#!CommitTicketReference repository=""
revision="f8c0a9321f07c4bbb338da59d57c38878c85d1f0"
Fixed #37080 -- Filtered by generic deprecation warnings in runtests.py.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/37080#comment:12>
Reply all
Reply to author
Forward
0 new messages