reorder_tests
Reorder an iterable of tests, grouping by the given TestCase classes.
This function also removes any duplicates and reorders so that tests of the same type are consecutive.
The result is returned as an iterator. classes is a sequence of types.
Tests that are instances of classes[0] are grouped first, followed by
instances of classes[1], etc. Tests that are not instances of any of the
classes are grouped last.
If reverse is True, the tests within each classes group are reversed,
but without reversing the order of classes itself.
The shuffler argument is an optional instance of this module's Shuffler
class. If provided, tests will be shuffled within each classes group, but
keeping tests with other tests of their TestCase class. Reversing is
applied after shuffling to allow reversing the same random order.
def reorder_tests(
tests: iterable,
classes: sequence of types,
reverse: boolean = False,
shuffler: Shuffler = None
) - > iterator
Reorder an iterable of tests, grouping by the given TestCase classes. This function also removes any duplicates and reorders so that tests of the same type are consecutive.
Parameters
| Name | Type | Description |
|---|---|---|
| tests | iterable | An iterable of test instances to be reordered and deduplicated. |
| classes | sequence of types | A sequence of TestCase classes used to determine the grouping priority; tests matching the first class are grouped first. |
| reverse | boolean = False | If True, reverses the order of tests within each class group after any shuffling has been applied. |
| shuffler | Shuffler = None | An optional Shuffler instance used to randomize the order of tests within each class group while maintaining class-based grouping. |
Returns
| Type | Description |
|---|---|
iterator | An iterator yielding the reordered and deduplicated test instances. |