Debugger/DebugServer.py

changeset 6901
f2c774c8db7e
parent 6894
df83ac87e0db
child 6904
3f35037a08d4
diff -r 060a30488316 -r f2c774c8db7e Debugger/DebugServer.py
--- a/Debugger/DebugServer.py	Mon Mar 25 20:18:47 2019 +0100
+++ b/Debugger/DebugServer.py	Tue Mar 26 19:29:30 2019 +0100
@@ -94,6 +94,8 @@
         unplanned)
     @signal clientInterpreterChanged(str) emitted to signal a change of the
         client interpreter
+    @signal utDiscovered(testCases, exc_type, exc_value) emitted after the
+        client has performed a test case discovery action
     @signal utPrepared(nrTests, exc_type, exc_value) emitted after the client
         has loaded a unittest suite
     @signal utFinished() emitted after the client signalled the end of the
@@ -142,6 +144,7 @@
     clientCapabilities = pyqtSignal(int, str, str)
     clientCompletionList = pyqtSignal(list, str)
     clientInterpreterChanged = pyqtSignal(str)
+    utDiscovered = pyqtSignal(list, str, str)
     utPrepared = pyqtSignal(int, str, str)
     utStartTest = pyqtSignal(str, str)
     utStopTest = pyqtSignal()
@@ -1311,11 +1314,52 @@
         @param text the text to be completed (string)
         """
         self.debuggerInterface.remoteCompletion(text)
-
+    
+    def remoteUTDiscover(self, clientType, forProject, venvName, syspath,
+                         workdir, discoveryStart):
+        """
+        Public method to perform a test case discovery.
+        
+        @param clientType client type to be used
+        @type str
+        @param forProject flag indicating a project related action
+        @type bool
+        @param venvName name of a virtual environment
+        @type str
+        @param syspath list of directories to be added to sys.path on the
+            remote side
+        @type list of str
+        @param workdir path name of the working directory
+        @type str
+        @param discoveryStart directory to start auto-discovery at
+        @type str
+        """
+        if clientType and clientType not in self.getSupportedLanguages():
+            # a not supported client language was requested
+            E5MessageBox.critical(
+                None,
+                self.tr("Start Debugger"),
+                self.tr(
+                    """<p>The debugger type <b>{0}</b> is not supported"""
+                    """ or not configured.</p>""").format(clientType)
+            )
+            return
+        
+        # Restart the client if there is already a program loaded.
+        try:
+            if clientType:
+                self.__setClientType(clientType)
+        except KeyError:
+            self.__setClientType('Python3')    # assume it is a Python3 file
+        self.startClient(False, forProject=forProject, venvName=venvName)
+        
+        self.debuggerInterface.remoteUTDiscover(
+            syspath, workdir, discoveryStart)
+    
     def remoteUTPrepare(self, fn, tn, tfn, failed, cov, covname, coverase,
                         clientType="", forProject=False, venvName="",
                         syspath=None, workdir="", discover=False,
-                        discoveryStart=""):
+                        discoveryStart="", testCases=None):
         """
         Public method to prepare a new unittest run.
         
@@ -1349,6 +1393,8 @@
         @type bool
         @param discoveryStart directory to start auto-discovery at
         @type str
+        @param testCases list of test cases to be loaded
+        @type list of str
         """
         if clientType and clientType not in self.getSupportedLanguages():
             # a not supported client language was requested
@@ -1374,7 +1420,7 @@
         
         self.debuggerInterface.remoteUTPrepare(
             fn, tn, tfn, failed, cov, covname, coverase, syspath, workdir,
-            discover, discoveryStart)
+            discover, discoveryStart, testCases)
         self.debugging = False
         self.running = True
         
@@ -1634,6 +1680,19 @@
             isCall, fromFile, fromLine, fromFunction,
             toFile, toLine, toFunction)
         
+    def clientUtDiscovered(self, testCases, exceptionType, exceptionValue):
+        """
+        Public method to process the client unittest discover info.
+        
+        @param testCases list of detected test cases
+        @type str
+        @param exceptionType exception type
+        @type str
+        @param exceptionValue exception message
+        @type str
+        """
+        self.utDiscovered.emit(testCases, exceptionType, exceptionValue)
+        
     def clientUtPrepared(self, result, exceptionType, exceptionValue):
         """
         Public method to process the client unittest prepared info.

eric ide

mercurial