Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 16 additions & 11 deletions testing/run-write-tests.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,29 +17,29 @@ Running and writing tests
Running
=======

The shortest, simplest way of running the test suite is the following command
from the root directory of your checkout (after you have
:ref:`built Python <compiling>`):
The shortest, simplest way of running the test suite is the following command,
which runs tests in parallel, from the root directory of your checkout
(after you have :ref:`built Python <compiling>`):

.. tab:: Unix

.. code-block:: shell

./python -m test
./python -m test -j0

.. tab:: macOS

.. code-block:: shell

./python.exe -m test
./python.exe -m test -j0

This works on :ref:`most <mac-python.exe>` macOS systems.

.. tab:: Windows

.. code-block:: dosbatch

.\python.bat -m test
.\python.bat -m test -j0

This will run the majority of tests, but exclude a small portion of them; these
excluded tests use special kinds of resources: for example, accessing the
Expand Down Expand Up @@ -139,26 +139,31 @@ But, there are several important notes:
In other words: if some module does not have ``unittest.main()``, then
most likely it does not support direct invocation.

If you have a multi-core or multi-CPU machine, you can enable parallel testing
Comment thread
StanFromIreland marked this conversation as resolved.
using several Python processes so as to speed up things:
By default, ``-j0`` runs tests in parallel using a number of worker processes
based on the CPU count, which is much faster but can interleave output
from different tests. To run tests sequentially, for example when debugging
a failure, drop the ``-j`` flag:

.. tab:: Unix

.. code-block:: shell

./python -m test -j0
./python -m test

.. tab:: macOS

.. code-block:: shell

./python.exe -m test -j0
./python.exe -m test

.. tab:: Windows

.. code-block:: dosbatch

.\python.bat -m test -j0
.\python.bat -m test

To limit how many tests run at once, pass an explicit number of
worker processes instead, such as ``-j2``.

.. _strenuous_testing:

Expand Down
Loading