--- a/eric7/Debugger/DebugServer.py Mon May 02 15:53:05 2022 +0200 +++ b/eric7/Debugger/DebugServer.py Wed Jun 01 13:48:49 2022 +0200 @@ -101,25 +101,6 @@ 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 - unittest - @signal utStartTest(testname, testdocu) emitted after the client has - started a test - @signal utStopTest() emitted after the client has finished a test - @signal utTestFailed(testname, exc_info, id) emitted after the client - reported a failed test - @signal utTestErrored(testname, exc_info, id) emitted after the client - reported an errored test - @signal utTestSkipped(testname, reason, id) emitted after the client - reported a skipped test - @signal utTestFailedExpected(testname, exc_info, id) emitted after the - client reported an expected test failure - @signal utTestSucceededUnexpected(testname, id) emitted after the client - reported an unexpected test success @signal callTraceInfo emitted after the client reported the call trace data (isCall, fromFile, fromLine, fromFunction, toFile, toLine, toFunction, debuggerId) @@ -158,16 +139,6 @@ clientCompletionList = pyqtSignal(list, str) clientInterpreterChanged = pyqtSignal(str) clientDebuggerId = pyqtSignal(str) - utDiscovered = pyqtSignal(list, str, str) - utPrepared = pyqtSignal(int, str, str) - utStartTest = pyqtSignal(str, str) - utStopTest = pyqtSignal() - utTestFailed = pyqtSignal(str, str, str) - utTestErrored = pyqtSignal(str, str, str) - utTestSkipped = pyqtSignal(str, str, str) - utTestFailedExpected = pyqtSignal(str, str, str) - utTestSucceededUnexpected = pyqtSignal(str, str) - utFinished = pyqtSignal() passiveDebugStarted = pyqtSignal(str, bool) callTraceInfo = pyqtSignal(bool, str, str, str, str, str, str, str) appendStdout = pyqtSignal(str) @@ -526,9 +497,12 @@ # only start the client, if we are not in passive mode if not self.passive: if self.clientProcess: - self.clientProcess.kill() - self.clientProcess.waitForFinished(1000) - self.clientProcess.deleteLater() + with contextlib.suppress(RuntimeError): + # Workaround: The wrapped C/C++ object of type QProcess + # gets deleted prematurely sometimes. + self.clientProcess.kill() + self.clientProcess.waitForFinished(1000) + self.clientProcess.deleteLater() self.clientProcess = None self.__forProject = forProject @@ -1539,137 +1513,6 @@ """ self.debuggerInterface.remoteCompletion(debuggerId, 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 - EricMessageBox.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="", testCases=None, debug=False): - """ - Public method to prepare a new unittest run. - - @param fn the filename to load - @type str - @param tn the testname to load - @type str - @param tfn the test function name to load tests from - @type str - @param failed list of failed test, if only failed test should be run - @type list of str - @param cov flag indicating collection of coverage data is requested - @type bool - @param covname filename to be used to assemble the coverage caches - filename - @type str - @param coverase flag indicating erasure of coverage data is requested - @type bool - @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 discover flag indicating to discover the tests automatically - @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 - @param debug flag indicating to run unittest with debugging - @type bool - """ - if clientType and clientType not in self.getSupportedLanguages(): - # a not supported client language was requested - EricMessageBox.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) - else: - self.__setClientType( - self.__findLanguageForExtension(os.path.splitext(fn)[1])) - except KeyError: - self.__setClientType('Python3') # assume it is a Python3 file - self.startClient(False, forProject=forProject, venvName=venvName) - - self.debuggerInterface.remoteUTPrepare( - fn, tn, tfn, failed, cov, covname, coverase, syspath, workdir, - discover, discoveryStart, testCases, debug) - self.running = True - self.debugging = debug - if debug: - self.__restoreBreakpoints() - self.__restoreWatchpoints() - - def remoteUTRun(self, debug=False, failfast=False): - """ - Public method to start a unittest run. - - @param debug flag indicating to run unittest with debugging - @type bool - @param failfast flag indicating to stop at the first error - @type bool - """ - self.debuggerInterface.remoteUTRun(debug, failfast) - - def remoteUTStop(self): - """ - public method to stop a unittest run. - """ - self.debuggerInterface.remoteUTStop() - def signalClientOutput(self, line, debuggerId): """ Public method to process a line of client output. @@ -2036,125 +1879,6 @@ isCall, fromFile, fromLine, fromFunction, toFile, toLine, toFunction, debuggerId) - 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. - - @param result number of test cases (0 = error) - @type int - @param exceptionType exception type - @type str - @param exceptionValue exception message - @type str - """ - self.utPrepared.emit(result, exceptionType, exceptionValue) - - def clientUtStartTest(self, testname, doc): - """ - Public method to process the client start test info. - - @param testname name of the test - @type str - @param doc short description of the test - @type str - """ - self.utStartTest.emit(testname, doc) - - def clientUtStopTest(self): - """ - Public method to process the client stop test info. - """ - self.utStopTest.emit() - - def clientUtTestFailed(self, testname, traceback, testId): - """ - Public method to process the client test failed info. - - @param testname name of the test - @type str - @param traceback lines of traceback info - @type list of str - @param testId id of the test - @type str - """ - self.utTestFailed.emit(testname, traceback, testId) - - def clientUtTestErrored(self, testname, traceback, testId): - """ - Public method to process the client test errored info. - - @param testname name of the test - @type str - @param traceback lines of traceback info - @type list of str - @param testId id of the test - @type str - """ - self.utTestErrored.emit(testname, traceback, testId) - - def clientUtTestSkipped(self, testname, reason, testId): - """ - Public method to process the client test skipped info. - - @param testname name of the test - @type str - @param reason reason for skipping the test - @type str - @param testId id of the test - @type str - """ - self.utTestSkipped.emit(testname, reason, testId) - - def clientUtTestFailedExpected(self, testname, traceback, testId): - """ - Public method to process the client test failed expected info. - - @param testname name of the test - @type str - @param traceback lines of traceback info - @type list of str - @param testId id of the test - @type str - """ - self.utTestFailedExpected.emit(testname, traceback, testId) - - def clientUtTestSucceededUnexpected(self, testname, testId): - """ - Public method to process the client test succeeded unexpected info. - - @param testname name of the test - @type str - @param testId id of the test - @type str - """ - self.utTestSucceededUnexpected.emit(testname, testId) - - def clientUtFinished(self, status): - """ - Public method to process the client unit test finished info. - - @param status exit status of the unit test - @type int - """ - self.utFinished.emit() - - self.clientExit.emit("", int(status), "", True, "") - self.debugging = False - self.running = False - def passiveStartUp(self, fn, exc, debuggerId): """ Public method to handle a passive debug connection.