Debugger/DebugServer.py

changeset 6901
f2c774c8db7e
parent 6894
df83ac87e0db
child 6904
3f35037a08d4
equal deleted inserted replaced
6900:060a30488316 6901:f2c774c8db7e
92 connected in passive debug mode 92 connected in passive debug mode
93 @signal clientGone(bool) emitted if the client went away (planned or 93 @signal clientGone(bool) emitted if the client went away (planned or
94 unplanned) 94 unplanned)
95 @signal clientInterpreterChanged(str) emitted to signal a change of the 95 @signal clientInterpreterChanged(str) emitted to signal a change of the
96 client interpreter 96 client interpreter
97 @signal utDiscovered(testCases, exc_type, exc_value) emitted after the
98 client has performed a test case discovery action
97 @signal utPrepared(nrTests, exc_type, exc_value) emitted after the client 99 @signal utPrepared(nrTests, exc_type, exc_value) emitted after the client
98 has loaded a unittest suite 100 has loaded a unittest suite
99 @signal utFinished() emitted after the client signalled the end of the 101 @signal utFinished() emitted after the client signalled the end of the
100 unittest 102 unittest
101 @signal utStartTest(testname, testdocu) emitted after the client has 103 @signal utStartTest(testname, testdocu) emitted after the client has
140 clientRawInput = pyqtSignal(str, bool) 142 clientRawInput = pyqtSignal(str, bool)
141 clientBanner = pyqtSignal(str, str, str, str) 143 clientBanner = pyqtSignal(str, str, str, str)
142 clientCapabilities = pyqtSignal(int, str, str) 144 clientCapabilities = pyqtSignal(int, str, str)
143 clientCompletionList = pyqtSignal(list, str) 145 clientCompletionList = pyqtSignal(list, str)
144 clientInterpreterChanged = pyqtSignal(str) 146 clientInterpreterChanged = pyqtSignal(str)
147 utDiscovered = pyqtSignal(list, str, str)
145 utPrepared = pyqtSignal(int, str, str) 148 utPrepared = pyqtSignal(int, str, str)
146 utStartTest = pyqtSignal(str, str) 149 utStartTest = pyqtSignal(str, str)
147 utStopTest = pyqtSignal() 150 utStopTest = pyqtSignal()
148 utTestFailed = pyqtSignal(str, str, str) 151 utTestFailed = pyqtSignal(str, str, str)
149 utTestErrored = pyqtSignal(str, str, str) 152 utTestErrored = pyqtSignal(str, str, str)
1309 from the remote client. 1312 from the remote client.
1310 1313
1311 @param text the text to be completed (string) 1314 @param text the text to be completed (string)
1312 """ 1315 """
1313 self.debuggerInterface.remoteCompletion(text) 1316 self.debuggerInterface.remoteCompletion(text)
1314 1317
1315 def remoteUTPrepare(self, fn, tn, tfn, failed, cov, covname, coverase, 1318 def remoteUTDiscover(self, clientType, forProject, venvName, syspath,
1316 clientType="", forProject=False, venvName="", 1319 workdir, discoveryStart):
1317 syspath=None, workdir="", discover=False, 1320 """
1318 discoveryStart=""): 1321 Public method to perform a test case discovery.
1319 """ 1322
1320 Public method to prepare a new unittest run.
1321
1322 @param fn the filename to load
1323 @type str
1324 @param tn the testname to load
1325 @type str
1326 @param tfn the test function name to load tests from
1327 @type str
1328 @param failed list of failed test, if only failed test should be run
1329 @type list of str
1330 @param cov flag indicating collection of coverage data is requested
1331 @type bool
1332 @param covname filename to be used to assemble the coverage caches
1333 filename
1334 @type str
1335 @param coverase flag indicating erasure of coverage data is requested
1336 @type bool
1337 @param clientType client type to be used 1323 @param clientType client type to be used
1338 @type str 1324 @type str
1339 @param forProject flag indicating a project related action 1325 @param forProject flag indicating a project related action
1340 @type bool 1326 @type bool
1341 @param venvName name of a virtual environment 1327 @param venvName name of a virtual environment
1343 @param syspath list of directories to be added to sys.path on the 1329 @param syspath list of directories to be added to sys.path on the
1344 remote side 1330 remote side
1345 @type list of str 1331 @type list of str
1346 @param workdir path name of the working directory 1332 @param workdir path name of the working directory
1347 @type str 1333 @type str
1348 @param discover flag indicating to discover the tests automatically
1349 @type bool
1350 @param discoveryStart directory to start auto-discovery at 1334 @param discoveryStart directory to start auto-discovery at
1351 @type str 1335 @type str
1352 """ 1336 """
1353 if clientType and clientType not in self.getSupportedLanguages(): 1337 if clientType and clientType not in self.getSupportedLanguages():
1354 # a not supported client language was requested 1338 # a not supported client language was requested
1363 1347
1364 # Restart the client if there is already a program loaded. 1348 # Restart the client if there is already a program loaded.
1365 try: 1349 try:
1366 if clientType: 1350 if clientType:
1367 self.__setClientType(clientType) 1351 self.__setClientType(clientType)
1352 except KeyError:
1353 self.__setClientType('Python3') # assume it is a Python3 file
1354 self.startClient(False, forProject=forProject, venvName=venvName)
1355
1356 self.debuggerInterface.remoteUTDiscover(
1357 syspath, workdir, discoveryStart)
1358
1359 def remoteUTPrepare(self, fn, tn, tfn, failed, cov, covname, coverase,
1360 clientType="", forProject=False, venvName="",
1361 syspath=None, workdir="", discover=False,
1362 discoveryStart="", testCases=None):
1363 """
1364 Public method to prepare a new unittest run.
1365
1366 @param fn the filename to load
1367 @type str
1368 @param tn the testname to load
1369 @type str
1370 @param tfn the test function name to load tests from
1371 @type str
1372 @param failed list of failed test, if only failed test should be run
1373 @type list of str
1374 @param cov flag indicating collection of coverage data is requested
1375 @type bool
1376 @param covname filename to be used to assemble the coverage caches
1377 filename
1378 @type str
1379 @param coverase flag indicating erasure of coverage data is requested
1380 @type bool
1381 @param clientType client type to be used
1382 @type str
1383 @param forProject flag indicating a project related action
1384 @type bool
1385 @param venvName name of a virtual environment
1386 @type str
1387 @param syspath list of directories to be added to sys.path on the
1388 remote side
1389 @type list of str
1390 @param workdir path name of the working directory
1391 @type str
1392 @param discover flag indicating to discover the tests automatically
1393 @type bool
1394 @param discoveryStart directory to start auto-discovery at
1395 @type str
1396 @param testCases list of test cases to be loaded
1397 @type list of str
1398 """
1399 if clientType and clientType not in self.getSupportedLanguages():
1400 # a not supported client language was requested
1401 E5MessageBox.critical(
1402 None,
1403 self.tr("Start Debugger"),
1404 self.tr(
1405 """<p>The debugger type <b>{0}</b> is not supported"""
1406 """ or not configured.</p>""").format(clientType)
1407 )
1408 return
1409
1410 # Restart the client if there is already a program loaded.
1411 try:
1412 if clientType:
1413 self.__setClientType(clientType)
1368 else: 1414 else:
1369 self.__setClientType( 1415 self.__setClientType(
1370 self.__findLanguageForExtension(os.path.splitext(fn)[1])) 1416 self.__findLanguageForExtension(os.path.splitext(fn)[1]))
1371 except KeyError: 1417 except KeyError:
1372 self.__setClientType('Python3') # assume it is a Python3 file 1418 self.__setClientType('Python3') # assume it is a Python3 file
1373 self.startClient(False, forProject=forProject, venvName=venvName) 1419 self.startClient(False, forProject=forProject, venvName=venvName)
1374 1420
1375 self.debuggerInterface.remoteUTPrepare( 1421 self.debuggerInterface.remoteUTPrepare(
1376 fn, tn, tfn, failed, cov, covname, coverase, syspath, workdir, 1422 fn, tn, tfn, failed, cov, covname, coverase, syspath, workdir,
1377 discover, discoveryStart) 1423 discover, discoveryStart, testCases)
1378 self.debugging = False 1424 self.debugging = False
1379 self.running = True 1425 self.running = True
1380 1426
1381 def remoteUTRun(self): 1427 def remoteUTRun(self):
1382 """ 1428 """
1632 """ 1678 """
1633 self.callTraceInfo.emit( 1679 self.callTraceInfo.emit(
1634 isCall, fromFile, fromLine, fromFunction, 1680 isCall, fromFile, fromLine, fromFunction,
1635 toFile, toLine, toFunction) 1681 toFile, toLine, toFunction)
1636 1682
1683 def clientUtDiscovered(self, testCases, exceptionType, exceptionValue):
1684 """
1685 Public method to process the client unittest discover info.
1686
1687 @param testCases list of detected test cases
1688 @type str
1689 @param exceptionType exception type
1690 @type str
1691 @param exceptionValue exception message
1692 @type str
1693 """
1694 self.utDiscovered.emit(testCases, exceptionType, exceptionValue)
1695
1637 def clientUtPrepared(self, result, exceptionType, exceptionValue): 1696 def clientUtPrepared(self, result, exceptionType, exceptionValue):
1638 """ 1697 """
1639 Public method to process the client unittest prepared info. 1698 Public method to process the client unittest prepared info.
1640 1699
1641 @param result number of test cases (0 = error) (integer) 1700 @param result number of test cases (0 = error) (integer)

eric ide

mercurial