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