b.t.T.TestLoader(unittest.TestLoader) : class documentation

Part of bzrlib.tests.TestUtil View In Hierarchy

Known subclasses: bzrlib.tests.TestUtil.FilteredByModuleTestLoader

Custom TestLoader to extend the stock python one.
Method loadTestsFromModuleNames use a custom means to load tests from modules.
Method loadTestsFromModuleName Undocumented
Method loadTestsFromModule Load tests from a module object.
Method getTestCaseNames Undocumented
def loadTestsFromModuleNames(self, names):
use a custom means to load tests from modules.

There is an undesirable glitch in the python TestLoader where a import error is ignore. We think this can be solved by ensuring the requested name is resolvable, if its not raising the original error.

def loadTestsFromModuleName(self, name):
def loadTestsFromModule(self, module):
Load tests from a module object.

This extension of the python test loader looks for an attribute load_tests in the module object, and if not found falls back to the regular python loadTestsFromModule.

If a load_tests attribute is found, it is called and the result is returned.

load_tests should be defined like so: >>> def load_tests(standard_tests, module, loader): >>> pass

standard_tests is the tests found by the stock TestLoader in the module, module and loader are the module and loader instances.

For instance, to run every test twice, you might do: >>> def load_tests(standard_tests, module, loader): >>> result = loader.suiteClass() >>> for test in iter_suite_tests(standard_tests): >>> result.addTests([test, test]) >>> return result

def getTestCaseNames(self, test_case_class):
API Documentation for Bazaar, generated by pydoctor at 2019-10-20 00:34:54.