8000 [MRG] Added additional tips for pytest usage by NicolasHug · Pull Request #13540 · scikit-learn/scikit-learn · GitHub
[go: up one dir, main page]

Skip to content

[MRG] Added additional tips for pytest usage #13540

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Mar 28, 2019
Merged
Show file tree
Hide file tree
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
2 changes: 2 additions & 0 deletions doc/developers/contributing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -643,6 +643,8 @@ We expect code coverage of new features to be at least around 90%.

3. Loop.

For guidelines on how to use ``pytest`` efficiently, see the
:ref:`pytest_tips`.


Developers web site
Expand Down
17 changes: 17 additions & 0 deletions doc/developers/tips.rst
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@ integration, consider `this browser extension
<https://github.com/codecov/browser-extension>`_. The coverage of each line
will be displayed as a color background behind the line number.


.. _pytest_tips:

Useful pytest aliases and flags
-------------------------------

Expand Down Expand Up @@ -90,6 +93,20 @@ When a unit test fails, the following tricks can make debugging easier:

pytest --pdbcls=IPython.terminal.debugger:TerminalPdb --capture no

Other `pytest` options that may become useful include:

- ``-x`` which exits on the first failed test
- ``--lf`` to rerun the tests that failed on the previous run
- ``--ff`` to rerun all previous tests, running the ones that failed first
- ``-s`` so that pytest does not capture the output of ``print()``
statements
- ``--tb=short`` or ``--tb=line`` to control the length of the logs

Since our continuous integration tests will error if ``DeprecationWarning``
or ``FutureWarning`` aren't properly caught, it is also recommended to run
``pytest`` along with the ``-Werror::DeprecationWarning`` and
``-Werror::FutureWarning`` flags.

.. _saved_replies:

Standard replies for reviewing
Expand Down
0