Part of bzrlib.tests.TestUtil View In Hierarchy
Known subclasses: bzrlib.tests.TestUtil.FilteredByModuleTestLoader
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 |
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.
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