MCPcopy Index your code
hub / github.com/RustPython/RustPython / loadTestsFromTestCase

Method loadTestsFromTestCase

Lib/unittest/loader.py:80–94  ·  view source on GitHub ↗

Return a suite of all test cases contained in testCaseClass

(self, testCaseClass)

Source from the content-addressed store, hash-verified

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"""

Calls 3

getTestCaseNamesMethod · 0.95
issubclassFunction · 0.85
hasattrFunction · 0.85