Skip to content

Commit f28ee51

Browse files
committed
DOC: Update xdist to provide more speed-up options and context (pandas-dev#48958) (pandas-dev#48535)
1 parent ee352b1 commit f28ee51

File tree

1 file changed

+44
-10
lines changed

1 file changed

+44
-10
lines changed

doc/source/development/contributing_codebase.rst

+44-10
Original file line numberDiff line numberDiff line change
@@ -790,14 +790,11 @@ Or with one of the following constructs::
790790
pytest pandas/tests/[test-module].py::[TestClass]
791791
pytest pandas/tests/[test-module].py::[TestClass]::[test_method]
792792

793-
Using `pytest-xdist <https://pypi.org/project/pytest-xdist>`_, one can
794-
speed up local testing on multicore machines. To use this feature, you will
795-
need to install ``pytest-xdist`` via::
796-
797-
pip install pytest-xdist
798-
799-
The ``-n`` flag then can be specified when running ``pytest`` to parallelize a test run
800-
across the number of specified cores or ``auto`` to utilize all the available cores on your machine.
793+
Using `pytest-xdist <https://pypi.org/project/pytest-xdist>`_, which is
794+
included in our 'pandas-dev' environment, one can speed up local testing on
795+
multicore machines. The -n flag then can be specified when running pytest to
796+
parallelize a test run across the number of specified cores or auto to
797+
utilize all the available cores on your machine.
801798

802799
.. code-block:: bash
803800
@@ -807,8 +804,45 @@ across the number of specified cores or ``auto`` to utilize all the available co
807804
# Utilizes all available cores
808805
pytest -n auto pandas
809806
810-
This can significantly reduce the time it takes to locally run tests before
811-
submitting a pull request.
807+
If you'd like to speed things along further a more advanced use of this
808+
command would look like this
809+
810+
.. code-block:: bash
811+
812+
pytest pandas --skip-slow --skip-network --skip-db -m "not single_cpu" -n 4 -r sxX
813+
814+
In addition to the multithreaded performance increase this improves test
815+
speed by skipping some tests:
816+
817+
- skip-slow: any test that takes long (think seconds rather than milliseconds)
818+
- skip-network: tests that require network connectivity
819+
- skip-db: tests that require a database
820+
821+
The -r flag will display a short summary info (see `pytest documentation <https://docs.pytest.org/en/4.6.x/usage.html#detailed-summary-report>`_)
822+
. Here we are displaying the number of:
823+
824+
- s: skipped tests
825+
- x: xfailed tests
826+
- X: xpassed tests
827+
828+
This is optional and can be removed if you don't like the summary. Using this
829+
command can significantly reduce the time it takes to locally run tests
830+
before submitting a pull request. If you require assistance with the results,
831+
which has happened in the past, please set a seed before running the command
832+
and opening a bug report, that way we can reproduce it. Here's an example
833+
for setting a seed on windows
834+
835+
.. code-block:: bash
836+
837+
set PYTHONHASHSEED=314159265
838+
pytest pandas --skip-slow --skip-network --skip-db -m "not single_cpu" -n 4 -r sxX
839+
840+
On Unix use
841+
842+
.. code-block:: bash
843+
844+
export PYTHONHASHSEED=$(python -c 'import random; print(random.randint(1, 4294967295))')
845+
pytest pandas --skip-slow --skip-network --skip-db -m "not single_cpu" -n 4 -r sxX
812846
813847
For more, see the `pytest <https://docs.pytest.org/en/latest/>`_ documentation.
814848

0 commit comments

Comments
 (0)