Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#17640 closed Bug (fixed)

Exception message causes DeprecationWarning in test_utils

Reported by: zsiciarz Owned by: zsiciarz
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 zsiciarz 5 years ago.
Got rid of DeprecationWarnings.
17640-2.diff (1.5 KB) - added by claudep 5 years ago.
Use assertRaisesRegexp

Download all attachments as: .zip

Change History (7)

Changed 5 years ago by zsiciarz

Got rid of DeprecationWarnings.

comment:1 Changed 5 years ago by claudep

  • Has patch set
  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Ready for checkin

comment:2 Changed 5 years ago by aaugustin

  • Patch needs improvement set
  • Triage Stage changed from Ready for checkin to Accepted

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

Changed 5 years ago by claudep

Use assertRaisesRegexp

comment:3 Changed 5 years ago by claudep

  • Patch needs improvement unset

Sure, this is better.

comment:4 Changed 5 years ago by aaugustin

  • Resolution set to fixed
  • Status changed from new to closed

In [17492]:

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

comment:5 Changed 5 years ago by aaugustin

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