Return an iterator that reorders the given tests, keeping tests next to other tests of their class. `tests` should be an iterable of tests that supports reversed().
(tests, shuffler=None, reverse=False)
| 1210 | |
| 1211 | |
| 1212 | def reorder_test_bin(tests, shuffler=None, reverse=False): |
| 1213 | """ |
| 1214 | Return an iterator that reorders the given tests, keeping tests next to |
| 1215 | other tests of their class. |
| 1216 | |
| 1217 | `tests` should be an iterable of tests that supports reversed(). |
| 1218 | """ |
| 1219 | if shuffler is None: |
| 1220 | if reverse: |
| 1221 | return reversed(tests) |
| 1222 | # The function must return an iterator. |
| 1223 | return iter(tests) |
| 1224 | |
| 1225 | tests = shuffle_tests(tests, shuffler) |
| 1226 | if not reverse: |
| 1227 | return tests |
| 1228 | # Arguments to reversed() must be reversible. |
| 1229 | return reversed(list(tests)) |
| 1230 | |
| 1231 | |
| 1232 | def reorder_tests(tests, classes, reverse=False, shuffler=None): |