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. |
This is useful for things like filtering tests or listing tests.
Parameters | hook | A callable that takes the output of the real
testrunner.find_tests and returns a thing with the same type and
structure. |
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.
Parameters | list_name | A filename that contains a newline-separated list of
test ids, as generated by list_tests . |
reorder_tests | if True, the tests contained in list_name
are reordered by id. Default is False: the ordering is preserved. | |
Returns | A callable that takes a result of testrunner.find_tests and
returns only those tests with ids in the file 'list_name'. |