DebugClients/Python3/DCTestResult.py

changeset 1166
a94b0a2fafd7
parent 1112
8a7d1b9d18db
child 1499
b4d0457afb15
--- a/DebugClients/Python3/DCTestResult.py	Sat Jul 02 18:19:03 2011 +0200
+++ b/DebugClients/Python3/DCTestResult.py	Sun Jul 03 18:01:53 2011 +0200
@@ -8,12 +8,12 @@
 """
 
 import select
-import traceback
 from unittest import TestResult
 
 
 from DebugProtocol import ResponseUTTestFailed, ResponseUTTestErrored, \
-    ResponseUTStartTest, ResponseUTStopTest
+    ResponseUTStartTest, ResponseUTStopTest, ResponseUTTestSkipped, \
+    ResponseUTTestFailedExpected, ResponseUTTestSucceededUnexpected
 
 
 class DCTestResult(TestResult):
@@ -39,7 +39,7 @@
         @param err The error traceback
         """
         TestResult.addFailure(self, test, err)
-        tracebackLines = traceback.format_exception(*(err + (10,)))
+        tracebackLines = self._exc_info_to_string(err, test)
         self.parent.write('{0}{1}\n'.format(ResponseUTTestFailed,
             str((str(test), tracebackLines))))
         
@@ -51,10 +51,42 @@
         @param err The error traceback
         """
         TestResult.addError(self, test, err)
-        tracebackLines = traceback.format_exception(*(err + (10,)))
+        tracebackLines = self._exc_info_to_string(err, test)
         self.parent.write('{0}{1}\n'.format(ResponseUTTestErrored,
             str((str(test), tracebackLines))))
         
+    def addSkip(self, test, reason):
+        """
+        Method called if a test was skipped.
+        
+        @param test reference to the test object
+        @param reason reason for skipping the test (string)
+        """
+        TestResult.addSkip(self, test, reason)
+        self.parent.write('{0}{1}\n'.format(ResponseUTTestSkipped,
+            str((str(test), reason))))
+        
+    def addExpectedFailure(self, test, err):
+        """
+        Method called if a test failed expected.
+        
+        @param test reference to the test object
+        @param err error traceback
+        """
+        TestResult.addExpectedFailure(self, test, err)
+        tracebackLines = self._exc_info_to_string(err, test)
+        self.parent.write('{0}{1}\n'.format(ResponseUTTestFailedExpected,
+            str((str(test), tracebackLines))))
+        
+    def addUnexpectedSuccess(self, test):
+        """
+        Method called if a test succeeded expectedly.
+        
+        @param test reference to the test object
+        """
+        TestResult.addUnexpectedSuccess(self, test)
+        self.parent.write('{0}{1}\n'.format(ResponseUTTestSucceededUnexpected, str(test)))
+        
     def startTest(self, test):
         """
         Method called at the start of a test.

eric ide

mercurial