def loadTestsFromTestCase(self, testCaseClass):
"""Return a suite of all tests cases contained in testCaseClass"""
if issubclass(testCaseClass, unittest.TestSuite):
raise TypeError("Test cases should not be derived from TestSuite. Maybe you meant to derive from TestCase?")
testCaseNames = self.getTestCaseNames(testCaseClass)
if not testCaseNames and hasattr(testCaseClass, 'runTest'):
testCaseNames = ['runTest']
if self.PROMPT:
ans = raw_input("Would you like to execute all tests in %s [Y]/N? " % testCaseClass).upper()
if ans == "N":
testCaseNamesToRun = []
for name in testCaseNames:
ans = raw_input("Would you like to execute test %s [Y]/N? " % name).upper()
if ans == "N":
continue
else:
testCaseNamesToRun.append(name)
testCaseNames = testCaseNamesToRun
return self.suiteClass(map(testCaseClass, testCaseNames))
评论列表
文章目录