l.s.t.customresult : module documentation

Part of lp.services.testing

Support code for using a custom test result in test.py.
Function patch_find_tests Add a post-processing hook to zope.testing.testrunner.find_tests.
Function filter_tests Create a hook for patch_find_tests that filters tests based on id.
def patch_find_tests(hook):
Add a post-processing hook to zope.testing.testrunner.find_tests.

This is useful for things like filtering tests or listing tests.

ParametershookA callable that takes the output of the real testrunner.find_tests and returns a thing with the same type and structure.
def filter_tests(list_name, reorder_tests=False):
Create a hook for patch_find_tests that filters tests based on id.

Note great care is taken to preserve the ordering of the original test cases, which is quite important if trying to figure out test isolation bugs. The original ordering is maintained within layers but since the results are returned as a dictionary the caller may shuffle the way the layers are run and there is nothing to be done about that here. In practice the layers are seen to be run in the same order.

However, test cases can still be reordered if reorder_tests is set to True: this is useful when tests are shuffled and the test shuffler is initialized using a particoular value. This way the same seed produces the same random ordering, regardless of whether the tests are filtered using -t or --load-list.

Should a test be listed, but not present in any of the suites, it is silently ignored.

Parameterslist_nameA filename that contains a newline-separated list of test ids, as generated by list_tests.
reorder_testsif True, the tests contained in list_name are reordered by id. Default is False: the ordering is preserved.
ReturnsA callable that takes a result of testrunner.find_tests and returns only those tests with ids in the file 'list_name'.
API Documentation for Launchpad, generated by pydoctor at 2018-10-21 00:00:10.