Code

Opened 2 years ago

Closed 2 years ago

Last modified 2 years ago

#17947 closed Bug (fixed)

tests do not change language back after fail

Reported by: andrey@… Owned by: claudep
Component: contrib.auth Version: master
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Currently if django management command have error, it calls sys.exit() and after that changes language to previous.

If I run command it is ok – no code executes after sys.exit, but ChangepasswordManagementCommandTestCase? catches SystemExit? exception and continues execution. And all tests after it have incorrect settings. Solution is to use finally to fix this code.

Attachments (1)

django-tests-lang.patch (1.2 KB) - added by andrey@… 2 years ago.

Download all attachments as: .zip

Change History (6)

Changed 2 years ago by andrey@…

comment:1 Changed 2 years ago by claudep

  • Cc claudep removed
  • Needs documentation unset
  • Needs tests unset
  • Owner changed from nobody to claudep
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Accepted

comment:2 Changed 2 years ago by claudep

Andrey, is the contrib.auth test change required to fix the bug?

comment:3 Changed 2 years ago by Andrey@…

Yes, this test previously worked with broken locale and after locale fix it will crash if project uses different language

comment:4 Changed 2 years ago by claudep

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

In [17823]:

Fixed #17947 -- Fixed language restore after management command even when exceptions occur. Thanks andrey@… for the report and the patch.

comment:5 Changed 2 years ago by claudep

Note that the auth test issue has been fixed seperately in r17811.

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.