Merge lp:~parthm/bzr/603461-ensure-no-var-named-message-2.2 into lp:bzr/2.2
Status: | Merged |
---|---|
Approved by: | Andrew Bennetts |
Approved revision: | no longer in the source branch. |
Merged at revision: | 5058 |
Proposed branch: | lp:~parthm/bzr/603461-ensure-no-var-named-message-2.2 |
Merge into: | lp:bzr/2.2 |
Diff against target: |
119 lines (+42/-9) 3 files modified
NEWS (+9/-0) bzrlib/errors.py (+5/-8) bzrlib/tests/test_errors.py (+28/-1) |
To merge this branch: | bzr merge lp:~parthm/bzr/603461-ensure-no-var-named-message-2.2 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Andrew Bennetts | Approve | ||
Vincent Ladeuil | Approve | ||
Review via email: mp+29837@code.launchpad.net |
Commit message
test to ensure that errors.BzrError subclasses don't use "message" as arg name for __init__ and _fmt (#603461)
Description of the change
This fix adds a test case to prevent bugs like bug #603461 i.e. use of "message" as format variable name in BzrError subclasses is a problem on some Python versions.
The test case checks subclasses of errors.BzrError for two things:
1. __init__ should not have argument named "message"
2. _fmt should not use "message" as a format variable name.
The patch also fixes existing _fmt strings that had "message" variable names in them.
One potentially breaking change could be the use of "message" as __init__ argument in LockError. I have changed this to "msg" and tests for bzr are passing. bzrlib does not use LockError with explicit argument name. A grep of some plugins (bzr-svn, bzr-grep, bzrtools) shows that LockError is not used directly. So I think it should be a safe change. If someone more familiar with use of LockError feels thats not the case I can special case it in the test case.
This sounds fine, thanks !