You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add --max-failures <n> option in test harness (#25569)
Add --max-failures <n> option in test harness to generalize on the
--failfast option (which is effectively a '--max-failures 0' mode).
This allows running the harness while allowing a couple of failures. I
find that when using `--failfast`, aborting on the first error is
sometimes a bit too eager, i.e. there might be a flaky test that
triggers the abort, or there might be an error that causes more than one
test to fail.
Examining test harness results, that interpreting a small handful of
failures (1,2,3...5) is still doable one-by-one, but when the number of
failures grows to, say, > 5, the typically I want to deal with the first
couple of errors only, and re-run the harness after that, assuming the
rest of the errors would be from the same root cause.
So this enables running with, say, `--max-failures 5`, and get info on
the first handful of errors, and ignore if any more errors occur.
This helps retain the failfast-like behavior while producing a bit more
info, and being a bit more tolerant to instabilities.
errlog('The version of python being used is not compatible with --failfast and --max-failures options. See https://github.com/python/cpython/issues/71936')
parser.add_argument('--failfast', action='store_true', help='If true, test run will abort on first failed test.')
484
+
parser.add_argument('--max-failures', type=int, default=2**31-1, help='If specified, test run will abort after N failed tests.')
484
485
parser.add_argument('--failing-and-slow-first', action='store_true', help='Run failing tests first, then sorted by slowest first. Combine with --failfast for fast fail-early CI runs.')
485
486
parser.add_argument('--start-at', metavar='NAME', help='Skip all tests up until <NAME>')
0 commit comments