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

Proposed by James Page
Status: Merged
Approved by: Richard Wilbur
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 Approve
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.
Revision history for this message
Richard Wilbur (richard-wilbur) wrote :

Thank you James for fixing the code rot.
+2

review: Approve
Revision history for this message
Richard Wilbur (richard-wilbur) wrote :

sent to pqm by email

Revision history for this message
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
=== modified file 'bzrlib/tests/test_config.py'
--- bzrlib/tests/test_config.py 2014-02-14 10:29:49 +0000
+++ bzrlib/tests/test_config.py 2015-07-06 11:08:23 +0000
@@ -2311,7 +2311,7 @@
2311 def assertConverted(self, expected, opt, value):2311 def assertConverted(self, expected, opt, value):
2312 self.assertEquals(expected, opt.convert_from_unicode(None, value))2312 self.assertEquals(expected, opt.convert_from_unicode(None, value))
23132313
2314 def assertWarns(self, opt, value):2314 def assertGenerateWarns(self, opt, value):
2315 warnings = []2315 warnings = []
2316 def warning(*args):2316 def warning(*args):
2317 warnings.append(args[0] % args[1:])2317 warnings.append(args[0] % args[1:])
@@ -2330,7 +2330,7 @@
2330 opt.invalid = None2330 opt.invalid = None
2331 self.assertEquals(None, opt.convert_from_unicode(None, invalid_value))2331 self.assertEquals(None, opt.convert_from_unicode(None, invalid_value))
2332 opt.invalid = 'warning'2332 opt.invalid = 'warning'
2333 self.assertWarns(opt, invalid_value)2333 self.assertGenerateWarns(opt, invalid_value)
2334 opt.invalid = 'error'2334 opt.invalid = 'error'
2335 self.assertErrors(opt, invalid_value)2335 self.assertErrors(opt, invalid_value)
23362336