Code

Opened 2 years ago

Closed 2 years ago

Last modified 2 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

Description

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

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

Attachments (2)

patch_17640.diff (1.4 KB) - added by zsiciarz 2 years ago.
Got rid of DeprecationWarnings.
17640-2.diff (1.5 KB) - added by claudep 2 years ago.
Use assertRaisesRegexp

Download all attachments as: .zip

Change History (7)

Changed 2 years ago by zsiciarz

Got rid of DeprecationWarnings.

comment:1 Changed 2 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 2 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 2 years ago by claudep

Use assertRaisesRegexp

comment:3 Changed 2 years ago by claudep

  • Patch needs improvement unset

Sure, this is better.

comment:4 Changed 2 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 2 years ago by aaugustin

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

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.