DebugClients/Python/DebugClientBase.py

changeset 6908
a56b500d7d2d
parent 6904
3f35037a08d4
diff -r d72fedf5310d -r a56b500d7d2d DebugClients/Python/DebugClientBase.py
--- a/DebugClients/Python/DebugClientBase.py	Sat Mar 30 14:16:34 2019 +0100
+++ b/DebugClients/Python/DebugClientBase.py	Sat Mar 30 14:20:29 2019 +0100
@@ -828,7 +828,8 @@
                         "message": "\n\n".join(testLoader.errors),
                     })
                 else:
-                    testsList = self.__assembleTestCasesList(test)
+                    testsList = self.__assembleTestCasesList(test,
+                                                             discoveryStart)
                     self.sendJsonCommand("ResponseUTDiscover", {
                         "testCasesList": testsList,
                         "exception": "",
@@ -949,28 +950,35 @@
             self.fork_child = (params["target"] == 'child')
             self.eventExit = True
     
-    def __assembleTestCasesList(self, suite):
+    def __assembleTestCasesList(self, suite, start):
         """
         Private method to assemble a list of test cases included in a test
         suite.
         
         @param suite test suite to be inspected
         @type unittest.TestSuite
-        @return list of tuples containing the test case ID and short
-            description
-        @rtype list of tuples of (str, str)
+        @param start name of directory discovery was started at
+        @type str
+        @return list of tuples containing the test case ID, a short description
+            and the path of the test file name
+        @rtype list of tuples of (str, str, str)
         """
         import unittest
         testCases = []
         for test in suite:
             if isinstance(test, unittest.TestSuite):
-                testCases.extend(self.__assembleTestCasesList(test))
+                testCases.extend(self.__assembleTestCasesList(test, start))
             else:
                 testId = test.id()
                 if "ModuleImportFailure" not in testId and \
                    "LoadTestsFailure" not in testId and \
                    "_FailedTest" not in testId:
-                    testCases.append((test.id(), test.shortDescription()))
+                    filename = os.path.join(
+                        start,
+                        test.__module__.replace(".", os.sep) + ".py")
+                    testCases.append(
+                        (test.id(), test.shortDescription(), filename)
+                    )
         return testCases
     
     def sendJsonCommand(self, method, params):

eric ide

mercurial