Skip to content

Commit 23a01f3

Browse files
committed
Document the pytest -k parameter
1 parent c1a9829 commit 23a01f3

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

doc/developers/contributing.rst

+15
Original file line numberDiff line numberDiff line change
@@ -304,6 +304,21 @@ rules before submitting a pull request:
304304

305305
$ make
306306

307+
* The full test suite takes fairly long to run. For faster iterations,
308+
it is possibly to select a subset of tests to run using pytest selectors.
309+
In particular, one can run a `single test based on its node ID
310+
<https://docs.pytest.org/en/latest/example/markers.html#selecting-tests-based-on-their-node-id>`_::
311+
312+
$ pytest -v sklearn/linear_model/tests/test_logistic.py::test_sparsify
313+
314+
or use the `-k pytest parameter
315+
<https://docs.pytest.org/en/latest/example/markers.html#using-k-expr-to-select-tests-based-on-their-name>`_
316+
to select tests based on their name. For instance,::
317+
318+
$ pytest sklearn/tests/test_common.py -v -k LogisticRegression
319+
320+
will run all common tests for the ``LogisticRegression`` estimator.
321+
307322
* When adding additional functionality, provide at least one example script
308323
in the ``examples/`` folder. Have a look at other examples for reference.
309324
Examples should demonstrate why the new functionality is useful in

0 commit comments

Comments
 (0)