Skip to content

Commit

Permalink
DOC Added additional tips for pytest usage (#13540)
Browse files Browse the repository at this point in the history
* Added additional tips for pytest

* Added --ff option

* typo
  • Loading branch information
NicolasHug authored and adrinjalali committed Mar 28, 2019
1 parent 0a0db97 commit 5b747cf
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
2 changes: 2 additions & 0 deletions doc/developers/contributing.rst
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
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 comments on commit 5b747cf

Please sign in to comment.