Skip to content

Commit 7ada3c7

Browse files
Add section on running tests sequentially
1 parent 7466a23 commit 7ada3c7

1 file changed

Lines changed: 24 additions & 0 deletions

File tree

‎testing/run-write-tests.rst‎

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,31 @@ But, there are several important notes:
139139
In other words: if some module does not have ``unittest.main()``, then
140140
most likely it does not support direct invocation.
141141

142+
By default, ``-j0`` runs tests in parallel using one worker process per CPU,
143+
which is much faster but can interleave output from different tests.
144+
To run tests sequentially, for example when debugging a failure,
145+
drop the ``-j`` flag:
142146

147+
.. tab:: Unix
148+
149+
.. code-block:: shell
150+
151+
./python -m test
152+
153+
.. tab:: macOS
154+
155+
.. code-block:: shell
156+
157+
./python.exe -m test
158+
159+
.. tab:: Windows
160+
161+
.. code-block:: dosbatch
162+
163+
.\python.bat -m test
164+
165+
To limit how many tests run at once, pass an explicit number of
166+
worker processes instead, such as ``-j2``.
143167

144168
.. _strenuous_testing:
145169

0 commit comments

Comments
 (0)