Patch #1061904 / bug #878275: give a nicer error message when someone

accidentally derives from TestSuite instead of TestCase.
This commit is contained in:
Johannes Gijsbers 2004-11-07 15:46:25 +00:00
parent c1d6536d60
commit d7b6ad4b60
1 changed files with 2 additions and 0 deletions

View File

@ -489,6 +489,8 @@ class TestLoader:
def loadTestsFromTestCase(self, testCaseClass):
"""Return a suite of all tests cases contained in testCaseClass"""
if issubclass(testCaseClass, 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']