DebugClients/Python/DebugClientBase.py

changeset 6908
a56b500d7d2d
parent 6904
3f35037a08d4
equal deleted inserted replaced
6907:d72fedf5310d 6908:a56b500d7d2d
826 "testCasesList": [], 826 "testCasesList": [],
827 "exception": "DiscoveryError", 827 "exception": "DiscoveryError",
828 "message": "\n\n".join(testLoader.errors), 828 "message": "\n\n".join(testLoader.errors),
829 }) 829 })
830 else: 830 else:
831 testsList = self.__assembleTestCasesList(test) 831 testsList = self.__assembleTestCasesList(test,
832 discoveryStart)
832 self.sendJsonCommand("ResponseUTDiscover", { 833 self.sendJsonCommand("ResponseUTDiscover", {
833 "testCasesList": testsList, 834 "testCasesList": testsList,
834 "exception": "", 835 "exception": "",
835 "message": "", 836 "message": "",
836 }) 837 })
947 elif method == "ResponseForkTo": 948 elif method == "ResponseForkTo":
948 # this results from a separate event loop 949 # this results from a separate event loop
949 self.fork_child = (params["target"] == 'child') 950 self.fork_child = (params["target"] == 'child')
950 self.eventExit = True 951 self.eventExit = True
951 952
952 def __assembleTestCasesList(self, suite): 953 def __assembleTestCasesList(self, suite, start):
953 """ 954 """
954 Private method to assemble a list of test cases included in a test 955 Private method to assemble a list of test cases included in a test
955 suite. 956 suite.
956 957
957 @param suite test suite to be inspected 958 @param suite test suite to be inspected
958 @type unittest.TestSuite 959 @type unittest.TestSuite
959 @return list of tuples containing the test case ID and short 960 @param start name of directory discovery was started at
960 description 961 @type str
961 @rtype list of tuples of (str, str) 962 @return list of tuples containing the test case ID, a short description
963 and the path of the test file name
964 @rtype list of tuples of (str, str, str)
962 """ 965 """
963 import unittest 966 import unittest
964 testCases = [] 967 testCases = []
965 for test in suite: 968 for test in suite:
966 if isinstance(test, unittest.TestSuite): 969 if isinstance(test, unittest.TestSuite):
967 testCases.extend(self.__assembleTestCasesList(test)) 970 testCases.extend(self.__assembleTestCasesList(test, start))
968 else: 971 else:
969 testId = test.id() 972 testId = test.id()
970 if "ModuleImportFailure" not in testId and \ 973 if "ModuleImportFailure" not in testId and \
971 "LoadTestsFailure" not in testId and \ 974 "LoadTestsFailure" not in testId and \
972 "_FailedTest" not in testId: 975 "_FailedTest" not in testId:
973 testCases.append((test.id(), test.shortDescription())) 976 filename = os.path.join(
977 start,
978 test.__module__.replace(".", os.sep) + ".py")
979 testCases.append(
980 (test.id(), test.shortDescription(), filename)
981 )
974 return testCases 982 return testCases
975 983
976 def sendJsonCommand(self, method, params): 984 def sendJsonCommand(self, method, params):
977 """ 985 """
978 Public method to send a single command or response to the IDE. 986 Public method to send a single command or response to the IDE.

eric ide

mercurial