eric7/DebugClients/Python/DCTestResult.py

branch
eric7
changeset 8542
f8d3b4511358
parent 8312
800c432b34c8
child 8881
54e42bc2437a
diff -r 927d57b6aae0 -r f8d3b4511358 eric7/DebugClients/Python/DCTestResult.py
--- a/eric7/DebugClients/Python/DCTestResult.py	Tue Aug 24 18:10:24 2021 +0200
+++ b/eric7/DebugClients/Python/DCTestResult.py	Wed Aug 25 17:33:29 2021 +0200
@@ -29,7 +29,7 @@
         TestResult.__init__(self)
         self.__dbgClient = dbgClient
         self.failfast = failfast
-        
+    
     def addFailure(self, test, err):
         """
         Public method called if a test failed.
@@ -44,7 +44,7 @@
             "traceback": tracebackLines,
             "id": test.id(),
         })
-        
+    
     def addError(self, test, err):
         """
         Public method called if a test errored.
@@ -59,7 +59,31 @@
             "traceback": tracebackLines,
             "id": test.id(),
         })
+    
+    def addSubTest(self, test, subtest, err):
+        """
+        Public method called for each subtest to record its result.
         
+        @param test reference to the test object
+        @param subtest reference to the subtest object
+        @param err error traceback
+        """
+        if err is not None:
+            TestResult.addSubTest(self, test, subtest, err)
+            tracebackLines = self._exc_info_to_string(err, test)
+            if issubclass(err[0], test.failureException):
+                self.__dbgClient.sendJsonCommand("ResponseUTTestFailed", {
+                    "testname": str(subtest),
+                    "traceback": tracebackLines,
+                    "id": test.id(),
+                })
+            else:
+                self.__dbgClient.sendJsonCommand("ResponseUTTestErrored", {
+                    "testname": str(subtest),
+                    "traceback": tracebackLines,
+                    "id": test.id(),
+                })
+    
     def addSkip(self, test, reason):
         """
         Public method called if a test was skipped.
@@ -73,7 +97,7 @@
             "reason": reason,
             "id": test.id(),
         })
-        
+    
     def addExpectedFailure(self, test, err):
         """
         Public method called if a test failed expected.
@@ -88,7 +112,7 @@
             "traceback": tracebackLines,
             "id": test.id(),
         })
-        
+    
     def addUnexpectedSuccess(self, test):
         """
         Public method called if a test succeeded expectedly.
@@ -100,7 +124,7 @@
             "testname": str(test),
             "id": test.id(),
         })
-        
+    
     def startTest(self, test):
         """
         Public method called at the start of a test.
@@ -112,7 +136,7 @@
             "testname": str(test),
             "description": test.shortDescription(),
         })
-
+    
     def stopTest(self, test):
         """
         Public method called at the end of a test.

eric ide

mercurial