@@ -790,14 +790,11 @@ Or with one of the following constructs::
790
790
pytest pandas/tests/[test-module].py::[TestClass]
791
791
pytest pandas/tests/[test-module].py::[TestClass]::[test_method]
792
792
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.
801
798
802
799
.. code-block :: bash
803
800
@@ -807,8 +804,45 @@ across the number of specified cores or ``auto`` to utilize all the available co
807
804
# Utilizes all available cores
808
805
pytest -n auto pandas
809
806
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
812
846
813
847
For more, see the `pytest <https://docs.pytest.org/en/latest/ >`_ documentation.
814
848
0 commit comments