Merge lp:~james-page/bzr/unittest2-assertWarns into lp:bzr

Proposed by James Page on 2015-07-06
Status: Merged
Approved by: Richard Wilbur on 2015-07-12
Approved revision: 6604
Merge reported by: Vincent Ladeuil
Merged at revision: not available
Proposed branch: lp:~james-page/bzr/unittest2-assertWarns
Merge into: lp:bzr
Diff against target: 20 lines (+2/-2)
1 file modified
bzrlib/tests/test_config.py (+2/-2)
To merge this branch: bzr merge lp:~james-page/bzr/unittest2-assertWarns
Reviewer Review Type Date Requested Status
Richard Wilbur 2015-07-06 Approve on 2015-07-12
Review via email: mp+263884@code.launchpad.net

Commit message

Fix name conflict between unittest2 and test_config.py. (James Page)

Description of the change

unittest2 >= 0.8.0 has an assertWarns method; this conflicts with the local use of the same method name in bzrlib/tests/test_config.py.

Rename assertWarns -> assertGenerateWarns to avoid the method name being overidden by unittest2.

To post a comment you must log in.
Richard Wilbur (richard-wilbur) wrote :

Thank you James for fixing the code rot.
+2

review: Approve
Richard Wilbur (richard-wilbur) wrote :

sent to pqm by email

Vincent Ladeuil (vila) wrote :

Sorry about the delay here and doubly sorry than I found your MP only after fixing the same issue in https://code.launchpad.net/~vila/bzr/1514210-config-test-failures/+merge/282591 :-/

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'bzrlib/tests/test_config.py'
2--- bzrlib/tests/test_config.py 2014-02-14 10:29:49 +0000
3+++ bzrlib/tests/test_config.py 2015-07-06 11:08:23 +0000
4@@ -2311,7 +2311,7 @@
5 def assertConverted(self, expected, opt, value):
6 self.assertEquals(expected, opt.convert_from_unicode(None, value))
7
8- def assertWarns(self, opt, value):
9+ def assertGenerateWarns(self, opt, value):
10 warnings = []
11 def warning(*args):
12 warnings.append(args[0] % args[1:])
13@@ -2330,7 +2330,7 @@
14 opt.invalid = None
15 self.assertEquals(None, opt.convert_from_unicode(None, invalid_value))
16 opt.invalid = 'warning'
17- self.assertWarns(opt, invalid_value)
18+ self.assertGenerateWarns(opt, invalid_value)
19 opt.invalid = 'error'
20 self.assertErrors(opt, invalid_value)
21