Return a suite of all test cases contained in testCaseClass
(self, testCaseClass)
| 78 | self._loading_packages = set() |
| 79 | |
| 80 | def loadTestsFromTestCase(self, testCaseClass): |
| 81 | """Return a suite of all test cases contained in testCaseClass""" |
| 82 | if issubclass(testCaseClass, suite.TestSuite): |
| 83 | raise TypeError("Test cases should not be derived from " |
| 84 | "TestSuite. Maybe you meant to derive from " |
| 85 | "TestCase?") |
| 86 | if testCaseClass in (case.TestCase, case.FunctionTestCase): |
| 87 | # We don't load any tests from base types that should not be loaded. |
| 88 | testCaseNames = [] |
| 89 | else: |
| 90 | testCaseNames = self.getTestCaseNames(testCaseClass) |
| 91 | if not testCaseNames and hasattr(testCaseClass, 'runTest'): |
| 92 | testCaseNames = ['runTest'] |
| 93 | loaded_suite = self.suiteClass(map(testCaseClass, testCaseNames)) |
| 94 | return loaded_suite |
| 95 | |
| 96 | def loadTestsFromModule(self, module, *, pattern=None): |
| 97 | """Return a suite of all test cases contained in the given module""" |