Rev 5497: (spiv) Remove ForwardingResult, in file:///home/pqm/archives/thelove/bzr/%2Btrunk/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Fri Oct 15 08:01:46 BST 2010


At file:///home/pqm/archives/thelove/bzr/%2Btrunk/

------------------------------------------------------------
revno: 5497 [merge]
revision-id: pqm at pqm.ubuntu.com-20101015070145-urfgyncl1z7zjovn
parent: pqm at pqm.ubuntu.com-20101015033949-lv2x1iwguy3c1fta
parent: andrew.bennetts at canonical.com-20101015021313-ma8eso4o98hc6d28
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Fri 2010-10-15 08:01:45 +0100
message:
  (spiv) Remove ForwardingResult,
   which has been obsoleted by testtools. (Andrew Bennetts)
modified:
  NEWS                           NEWS-20050323055033-4e00b5db738777ff
  bzrlib/tests/__init__.py       selftest.py-20050531073622-8d0e3c8845c97a64
  bzrlib/tests/test_selftest.py  test_selftest.py-20051202044319-c110a115d8c0456a
=== modified file 'NEWS'
--- a/NEWS	2010-10-13 06:33:55 +0000
+++ b/NEWS	2010-10-15 02:13:13 +0000
@@ -56,6 +56,9 @@
 API Changes
 ***********
 
+* ``bzrlib.tests.ForwardingResult`` no longer exists.  Use
+  ``testtools.ExtendedToOriginalDecorator`` instead.  (Andrew Bennetts)
+
 Internals
 *********
 

=== modified file 'bzrlib/tests/__init__.py'
--- a/bzrlib/tests/__init__.py	2010-10-11 22:36:23 +0000
+++ b/bzrlib/tests/__init__.py	2010-10-15 02:13:13 +0000
@@ -89,10 +89,9 @@
 except ImportError:
     # lsprof not available
     pass
-from bzrlib.merge import merge_inner
 import bzrlib.merge3
 import bzrlib.plugin
-from bzrlib.smart import client, request, server
+from bzrlib.smart import client, request
 import bzrlib.store
 from bzrlib import symbol_versioning
 from bzrlib.symbol_versioning import (
@@ -116,7 +115,6 @@
 from bzrlib.ui import NullProgressView
 from bzrlib.ui.text import TextUIFactory
 import bzrlib.version_info_formats.format_custom
-from bzrlib.workingtree import WorkingTree, WorkingTreeFormat2
 
 # Mark this python module as being part of the implementation
 # of unittest: this gives us better tracebacks where the last
@@ -3353,39 +3351,7 @@
     return result
 
 
-class ForwardingResult(unittest.TestResult):
-
-    def __init__(self, target):
-        unittest.TestResult.__init__(self)
-        self.result = target
-
-    def startTest(self, test):
-        self.result.startTest(test)
-
-    def stopTest(self, test):
-        self.result.stopTest(test)
-
-    def startTestRun(self):
-        self.result.startTestRun()
-
-    def stopTestRun(self):
-        self.result.stopTestRun()
-
-    def addSkip(self, test, reason):
-        self.result.addSkip(test, reason)
-
-    def addSuccess(self, test):
-        self.result.addSuccess(test)
-
-    def addError(self, test, err):
-        self.result.addError(test, err)
-
-    def addFailure(self, test, err):
-        self.result.addFailure(test, err)
-ForwardingResult = testtools.ExtendedToOriginalDecorator
-
-
-class ProfileResult(ForwardingResult):
+class ProfileResult(testtools.ExtendedToOriginalDecorator):
     """Generate profiling data for all activity between start and success.
     
     The profile data is appended to the test's _benchcalls attribute and can
@@ -3403,7 +3369,7 @@
         # unavoidably fail.
         bzrlib.lsprof.BzrProfiler.profiler_block = 0
         self.profiler.start()
-        ForwardingResult.startTest(self, test)
+        testtools.ExtendedToOriginalDecorator.startTest(self, test)
 
     def addSuccess(self, test):
         stats = self.profiler.stop()
@@ -3413,10 +3379,10 @@
             test._benchcalls = []
             calls = test._benchcalls
         calls.append(((test.id(), "", ""), stats))
-        ForwardingResult.addSuccess(self, test)
+        testtools.ExtendedToOriginalDecorator.addSuccess(self, test)
 
     def stopTest(self, test):
-        ForwardingResult.stopTest(self, test)
+        testtools.ExtendedToOriginalDecorator.stopTest(self, test)
         self.profiler = None
 
 

=== modified file 'bzrlib/tests/test_selftest.py'
--- a/bzrlib/tests/test_selftest.py	2010-10-08 01:43:13 +0000
+++ b/bzrlib/tests/test_selftest.py	2010-10-15 02:13:13 +0000
@@ -26,7 +26,10 @@
 import unittest
 import warnings
 
-from testtools import MultiTestResult
+from testtools import (
+    ExtendedToOriginalDecorator,
+    MultiTestResult,
+    )
 from testtools.content import Content
 from testtools.content_type import ContentType
 from testtools.matchers import (
@@ -1119,9 +1122,9 @@
     def test_result_decorator(self):
         # decorate results
         calls = []
-        class LoggingDecorator(tests.ForwardingResult):
+        class LoggingDecorator(ExtendedToOriginalDecorator):
             def startTest(self, test):
-                tests.ForwardingResult.startTest(self, test)
+                ExtendedToOriginalDecorator.startTest(self, test)
                 calls.append('start')
         test = unittest.FunctionTestCase(lambda:None)
         stream = StringIO()
@@ -1266,9 +1269,9 @@
     def test_startTestRun(self):
         """run should call result.startTestRun()"""
         calls = []
-        class LoggingDecorator(tests.ForwardingResult):
+        class LoggingDecorator(ExtendedToOriginalDecorator):
             def startTestRun(self):
-                tests.ForwardingResult.startTestRun(self)
+                ExtendedToOriginalDecorator.startTestRun(self)
                 calls.append('startTestRun')
         test = unittest.FunctionTestCase(lambda:None)
         stream = StringIO()
@@ -1280,9 +1283,9 @@
     def test_stopTestRun(self):
         """run should call result.stopTestRun()"""
         calls = []
-        class LoggingDecorator(tests.ForwardingResult):
+        class LoggingDecorator(ExtendedToOriginalDecorator):
             def stopTestRun(self):
-                tests.ForwardingResult.stopTestRun(self)
+                ExtendedToOriginalDecorator.stopTestRun(self)
                 calls.append('stopTestRun')
         test = unittest.FunctionTestCase(lambda:None)
         stream = StringIO()
@@ -2066,7 +2069,7 @@
             def __call__(test, result):
                 test.run(result)
             def run(test, result):
-                self.assertIsInstance(result, tests.ForwardingResult)
+                self.assertIsInstance(result, ExtendedToOriginalDecorator)
                 calls.append("called")
             def countTestCases(self):
                 return 1




More information about the bazaar-commits mailing list