Opened 12 years ago

Closed 11 years ago

#20083 closed Bug (worksforme)

Fix for #18985 makes it impossible to filter deprecation warnings

Reported by: Aymeric Augustin Owned by: nobody
Component: Core (Other) Version: 1.5
Severity: Normal Keywords:
Cc: hv@… Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

The following does nothing on Python >= 2.7 because warnings are piped into logging since [44046e8a]:

warnings.filterwarnings(
    'error',
    r'django\.conf\.urls\.defaults is deprecated; use django\.conf\.urls instead',
    DeprecationWarning,
    r'django\.conf\.urls\.defaults')

That's a bit annoying.

Change History (5)

comment:1 by Brent O'Connor, 12 years ago

I agree. I ran into this same issue.

comment:2 by Jacob, 12 years ago

Triage Stage: UnreviewedAccepted

comment:3 by Thomas Güttler, 11 years ago

Cc: hv@… added

comment:4 by Claude Paroz <claude@…>, 11 years ago

In 8446a2438ffeab845e31cba4489f03fccc387298:

Added test about error filterwarnings

Refs #20083.

comment:5 by Claude Paroz, 11 years ago

Resolution: worksforme
Status: newclosed

Looking at the source code of the warnings module, it seems that raising the exception precedes the showwarning call, hence routing through logging should not affect error filters. I've just added a test for this. But it may be that recent commits with addition of DeprecationWarning subclasses for Django deprecations has also helped.

Note: See TracTickets for help on using tickets.
Back to Top