Rev 6608: (vila) Rename assertWarns in test_config to avoid clashing with unittest2 in file:///srv/pqm.bazaar-vcs.org/archives/thelove/bzr/%2Btrunk/

Patch Queue Manager pqm at pqm.ubuntu.com
Fri Jan 15 08:53:02 UTC 2016


At file:///srv/pqm.bazaar-vcs.org/archives/thelove/bzr/%2Btrunk/

------------------------------------------------------------
revno: 6608 [merge]
revision-id: pqm at pqm.ubuntu.com-20160115085302-3tqacjaebe4usq4e
parent: pqm at pqm.ubuntu.com-20151217183900-0719du2uv1kwu3lc
parent: v.ladeuil+lp at free.fr-20160114141033-l0sj9eh7g1g6uo4p
committer: Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Fri 2016-01-15 08:53:02 +0000
message:
  (vila) Rename assertWarns in test_config to avoid clashing with unittest2
   assertWarns. (Vincent Ladeuil)
modified:
  bzrlib/tests/test_config.py    testconfig.py-20051011041908-742d0c15d8d8c8eb
  doc/en/release-notes/bzr-2.7.txt bzr2.7.txt-20130727124539-wnx897hy9l2h9f7x-1
=== modified file 'bzrlib/tests/test_config.py'
--- a/bzrlib/tests/test_config.py	2014-02-14 10:29:49 +0000
+++ b/bzrlib/tests/test_config.py	2016-01-14 14:10:33 +0000
@@ -1,4 +1,4 @@
-# Copyright (C) 2005-2012 Canonical Ltd
+# Copyright (C) 2005-2014, 2016 Canonical Ltd
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -2306,13 +2306,14 @@
         self.assertEquals('foo', opt.get_help_topic())
 
 
-class TestOptionConverterMixin(object):
+class TestOptionConverter(tests.TestCase):
 
     def assertConverted(self, expected, opt, value):
         self.assertEquals(expected, opt.convert_from_unicode(None, value))
 
-    def assertWarns(self, opt, value):
+    def assertCallsWarning(self, opt, value):
         warnings = []
+
         def warning(*args):
             warnings.append(args[0] % args[1:])
         self.overrideAttr(trace, 'warning', warning)
@@ -2322,7 +2323,7 @@
             'Value "%s" is not valid for "%s"' % (value, opt.name),
             warnings[0])
 
-    def assertErrors(self, opt, value):
+    def assertCallsError(self, opt, value):
         self.assertRaises(errors.ConfigOptionValueError,
                           opt.convert_from_unicode, None, value)
 
@@ -2330,12 +2331,12 @@
         opt.invalid = None
         self.assertEquals(None, opt.convert_from_unicode(None, invalid_value))
         opt.invalid = 'warning'
-        self.assertWarns(opt, invalid_value)
+        self.assertCallsWarning(opt, invalid_value)
         opt.invalid = 'error'
-        self.assertErrors(opt, invalid_value)
-
-
-class TestOptionWithBooleanConverter(tests.TestCase, TestOptionConverterMixin):
+        self.assertCallsError(opt, invalid_value)
+
+
+class TestOptionWithBooleanConverter(TestOptionConverter):
 
     def get_option(self):
         return config.Option('foo', help='A boolean.',
@@ -2355,7 +2356,7 @@
         self.assertConverted(False, opt, u'False')
 
 
-class TestOptionWithIntegerConverter(tests.TestCase, TestOptionConverterMixin):
+class TestOptionWithIntegerConverter(TestOptionConverter):
 
     def get_option(self):
         return config.Option('foo', help='An integer.',
@@ -2373,7 +2374,7 @@
         self.assertConverted(16, opt, u'16')
 
 
-class TestOptionWithSIUnitConverter(tests.TestCase, TestOptionConverterMixin):
+class TestOptionWithSIUnitConverter(TestOptionConverter):
 
     def get_option(self):
         return config.Option('foo', help='An integer in SI units.',
@@ -2382,8 +2383,8 @@
     def test_convert_invalid(self):
         opt = self.get_option()
         self.assertConvertInvalid(opt, u'not-a-unit')
-        self.assertConvertInvalid(opt, u'Gb') # Forgot the int
-        self.assertConvertInvalid(opt, u'1b') # Forgot the unit
+        self.assertConvertInvalid(opt, u'Gb')  # Forgot the value
+        self.assertConvertInvalid(opt, u'1b')  # Forgot the unit
         self.assertConvertInvalid(opt, u'1GG')
         self.assertConvertInvalid(opt, u'1Mbb')
         self.assertConvertInvalid(opt, u'1MM')
@@ -2398,7 +2399,7 @@
         self.assertConverted(100, opt, u'100')
 
 
-class TestListOption(tests.TestCase, TestOptionConverterMixin):
+class TestListOption(TestOptionConverter):
 
     def get_option(self):
         return config.ListOption('foo', help='A list.')
@@ -2413,7 +2414,7 @@
     def test_convert_valid(self):
         opt = self.get_option()
         # An empty string is an empty list
-        self.assertConverted([], opt, '') # Using a bare str() just in case
+        self.assertConverted([], opt, '')  # Using a bare str() just in case
         self.assertConverted([], opt, u'')
         # A boolean
         self.assertConverted([u'True'], opt, u'True')
@@ -2423,11 +2424,11 @@
         self.assertConverted([u'bar'], opt, u'bar')
 
 
-class TestRegistryOption(tests.TestCase, TestOptionConverterMixin):
+class TestRegistryOption(TestOptionConverter):
 
     def get_option(self, registry):
         return config.RegistryOption('foo', registry,
-                help='A registry option.')
+                                     help='A registry option.')
 
     def test_convert_invalid(self):
         registry = _mod_registry.Registry()

=== modified file 'doc/en/release-notes/bzr-2.7.txt'
--- a/doc/en/release-notes/bzr-2.7.txt	2015-09-06 21:12:17 +0000
+++ b/doc/en/release-notes/bzr-2.7.txt	2016-01-14 14:10:33 +0000
@@ -89,12 +89,12 @@
 * Handle (minor) incompatible change in python 2.7.6 leading to test
   failures. Only tests are affected. (Vincent Ladeuil, #1303879)
 
-* Take python 2.7.6 late (better than never) bugfix in ntpath.py into
-  account. Only tests are affected (Vincent Ladeuil, #1303879).
-
 * Remove wrong assumption about how TCP server and client interact when run
   inside the same process. (Vincent Ladeuil, #1269886).
 
+* Rename assertWarns in bt.test_config so it doesn't clash with the
+  assertWarns introduced in recent python (Vincent Ladeuil, #1514210)
+    
 * Restrict access to '.netrc' in tests or recent python (2.7.5-8) will
   complain. (Vincent Ladeuil, #1233413)
 
@@ -102,5 +102,8 @@
   way to fix them without testing on windows itself.
   (Vincent Ladeuil, #1451448)
      
+* Take python 2.7.6 late (better than never) bugfix in ntpath.py into
+  account. Only tests are affected (Vincent Ladeuil, #1303879).
+
 ..
    vim: tw=74 ft=rst ff=unix




More information about the bazaar-commits mailing list