Skip to content

Commit b681e27

Browse files
docs: explain bisecting failing tests
1 parent dce8cdf commit b681e27

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

‎testing/run-write-tests.rst‎

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,25 @@ verbose mode (using ``-v``), so that individual failures are detailed:
8989
9090
.\python.bat -m test -v test_abc
9191
92+
If a test module has several tests and only some of them fail, you can use the
93+
``test.bisect_cmd`` helper to narrow down which tests reproduce the failure.
94+
The helper repeatedly runs random subsets of the tests, so the failure should
95+
be reproducible for the bisection to be useful. From the root of the checkout,
96+
run it with the test module name and any test-runner arguments needed to
97+
reproduce the failure::
98+
99+
./python -m test.bisect_cmd test_abc
100+
101+
By default, bisection stops when one failing test remains or after 100
102+
iterations. Use ``-n`` to stop with a larger number of tests, ``-N`` to change
103+
the iteration limit, or ``-o`` to write the current failing test list to a
104+
file::
105+
106+
./python -m test.bisect_cmd -n 2 -N 200 -o failing-tests.txt test_abc
107+
108+
The helper is part of the CPython test suite and is available in a built
109+
checkout; see ``./python -m test.bisect_cmd -h`` for all options.
110+
92111
To run a single test case, use the ``unittest`` module, providing the import
93112
path to the test case:
94113

0 commit comments

Comments
 (0)