Skip to main content

shuffle_tests

Return an iterator over the given tests in a shuffled order, keeping tests next to other tests of their class.

def shuffle_tests(
tests: iterable,
shuffler: object
) - > iterator

Return an iterator over the given tests in a shuffled order, keeping tests next to other tests of their class.

Parameters

NameTypeDescription
testsiterableAn iterable of test cases to be reorganized
shufflerobjectAn object responsible for performing the shuffle logic, expected to have a shuffle method that accepts a key function

Returns

TypeDescription
iteratorAn iterator that yields tests in a randomized order while maintaining class-level grouping