Opened 5 years ago

Closed 4 years ago

Last modified 4 years ago

#17947 closed Bug (fixed)

tests do not change language back after fail

Reported by: andrey@… Owned by: Claude Paroz
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@… 5 years ago.

Download all attachments as: .zip

Change History (6)

Changed 5 years ago by andrey@…

Attachment: django-tests-lang.patch added

comment:1 Changed 5 years ago by Claude Paroz

Cc: Claude Paroz removed
Needs documentation: unset
Needs tests: unset
Owner: changed from nobody to Claude Paroz
Patch needs improvement: unset
Triage Stage: UnreviewedAccepted

comment:2 Changed 5 years ago by Claude Paroz

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

comment:3 Changed 5 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 4 years ago by Claude Paroz

Resolution: fixed
Status: newclosed

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 4 years ago by Claude Paroz

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

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