Support progress on the ExtendedToOriginal decorator.
authorRobert Collins <robertc@robertcollins.net>
Mon, 19 Oct 2009 07:48:32 +0000 (18:48 +1100)
committerRobert Collins <robertc@robertcollins.net>
Mon, 19 Oct 2009 07:48:32 +0000 (18:48 +1100)
python/subunit/test_results.py
python/subunit/tests/test_test_results.py

index 66bb403af329f9e366508aca0dfa64e4a556f142..49fc7313677229f0af94002392e78a1d56b1eb80 100644 (file)
@@ -329,6 +329,12 @@ class ExtendedToOriginalDecorator(object):
             lines.append('------------\n')
         return ''.join(lines)
 
+    def progress(self, offset, whence):
+        method = getattr(self.decorated, 'progress', None)
+        if method is None:
+            return
+        return method(offset, whence)
+
     def startTest(self, test):
         return self.decorated.startTest(test)
 
index bdb603f34451a58270dba0e06a88c2a27dc152a2..7400f0b48578efb8dc733fb7415a9e71ad52b79f 100644 (file)
@@ -131,6 +131,9 @@ class ExtendedTestResult(Python27TestResult):
         else:
             self._calls.append(('addUnexpectedSuccess', test))
 
+    def progress(self, offset, whence):
+        self._calls.append(('progress', offset, whence))
+
 
 class TestExtendedToOriginalResultDecoratorBase(unittest.TestCase):
 
@@ -237,6 +240,19 @@ class TestExtendedToOriginalResultDecoratorBase(unittest.TestCase):
 class TestExtendedToOriginalResultDecorator(
     TestExtendedToOriginalResultDecoratorBase):
 
+    def test_progress_py26(self):
+        self.make_26_result()
+        self.converter.progress(1, 2)
+
+    def test_progress_py27(self):
+        self.make_27_result()
+        self.converter.progress(1, 2)
+
+    def test_progress_pyextended(self):
+        self.make_extended_result()
+        self.converter.progress(1, 2)
+        self.assertEqual([('progress', 1, 2)], self.result._calls)
+
     def test_startTest_py26(self):
         self.make_26_result()
         self.converter.startTest(self)