Rev 5088: (spiv) Add TestCase.__copy__, in file:///home/pqm/archives/thelove/bzr/2.2/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Tue Sep 14 16:09:49 BST 2010


At file:///home/pqm/archives/thelove/bzr/2.2/

------------------------------------------------------------
revno: 5088 [merge]
revision-id: pqm at pqm.ubuntu.com-20100914150947-prj9ec5vbo0rcqj3
parent: pqm at pqm.ubuntu.com-20100914083019-bc7f61vm5izl7z1a
parent: andrew.bennetts at canonical.com-20100914022334-ec0xdkcqhcw4b51o
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: 2.2
timestamp: Tue 2010-09-14 16:09:47 +0100
message:
  (spiv) Add TestCase.__copy__,
   to avoid sharing details dicts etc between cloned tests. (Andrew Bennetts)
modified:
  NEWS                           NEWS-20050323055033-4e00b5db738777ff
  bzrlib/tests/__init__.py       selftest.py-20050531073622-8d0e3c8845c97a64
=== modified file 'NEWS'
--- a/NEWS	2010-09-14 02:06:03 +0000
+++ b/NEWS	2010-09-14 15:09:47 +0000
@@ -74,6 +74,13 @@
 Testing
 *******
 
+* Tracebacks from a parameterized test are no longer reported against every
+  parameterization of that test.  This was done by adding a simple
+  ``__copy__`` method to TestCase, so that ``multiply_tests`` no longer
+  causes testtools.TestCase instances to share a details dict.
+  (Andrew Bennetts)
+
+
 bzr 2.2
 #######
 

=== modified file 'bzrlib/tests/__init__.py'
--- a/bzrlib/tests/__init__.py	2010-07-29 04:07:27 +0000
+++ b/bzrlib/tests/__init__.py	2010-09-14 02:23:34 +0000
@@ -801,6 +801,7 @@
     _gather_lsprof_in_benchmarks = False
 
     def __init__(self, methodName='testMethod'):
+        self.__methodName = methodName
         super(TestCase, self).__init__(methodName)
         self._cleanups = []
         self._directory_isolation = True
@@ -809,6 +810,9 @@
         self.exception_handlers.insert(0,
             (TestNotApplicable, self._do_not_applicable))
 
+    def __copy__(self):
+        return self.__class__(self.__methodName)
+
     def setUp(self):
         super(TestCase, self).setUp()
         for feature in getattr(self, '_test_needs_features', []):




More information about the bazaar-commits mailing list