Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#17640 closed Bug (fixed)

Exception message causes DeprecationWarning in test_utils

Reported by: Zbigniew Siciarz Owned by: Zbigniew Siciarz
Component: Testing framework Version: 1.4-alpha-1
Severity: Normal Keywords: deprecation, tests
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: yes UI/UX: no


When running Django tests on Python 2.7 with -Wall, the tests in regressiontests/test_utils/ raise a DeprecationWarning as follows:

C:\Users\USER\v\django14\django\tests\regressiontests\test_utils\ DeprecationWarning: BaseException.message has been deprecated as of Python 2.6

Attachments (2)

patch_17640.diff (1.4 KB) - added by Zbigniew Siciarz 7 years ago.
Got rid of DeprecationWarnings.
17640-2.diff (1.5 KB) - added by Claude Paroz 7 years ago.
Use assertRaisesRegexp

Download all attachments as: .zip

Change History (7)

Changed 7 years ago by Zbigniew Siciarz

Attachment: patch_17640.diff added

Got rid of DeprecationWarnings.

comment:1 Changed 7 years ago by Claude Paroz

Has patch: set
Triage Stage: UnreviewedReady for checkin

comment:2 Changed 7 years ago by Aymeric Augustin

Patch needs improvement: set
Triage Stage: Ready for checkinAccepted

I think it'd be best to convert these tests to use assertRaises as a context manager instead.

Changed 7 years ago by Claude Paroz

Attachment: 17640-2.diff added

Use assertRaisesRegexp

comment:3 Changed 7 years ago by Claude Paroz

Patch needs improvement: unset

Sure, this is better.

comment:4 Changed 7 years ago by Aymeric Augustin

Resolution: fixed
Status: newclosed

In [17492]:

Fixed #17640 -- Avoided a DeprecationWarning in the test suite. Thanks zsiciarz and claudep.

comment:5 Changed 7 years ago by Aymeric Augustin

I've marked the regexps as raw strings for clarity (even though it isn't necessary, strictly speaking).

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