From feadbb402477f78fcd560ad3f1ad339025b2be23 Mon Sep 17 00:00:00 2001 From: Nicolas Hug Date: Thu, 28 Mar 2019 09:05:32 -0400 Subject: [PATCH 1/3] Added additional tips for pytest --- doc/developers/contributing.rst | 2 ++ doc/developers/tips.rst | 16 ++++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/doc/developers/contributing.rst b/doc/developers/contributing.rst index 9a5ba2453cfe6..5d42f6faf5e47 100644 --- a/doc/developers/contributing.rst +++ b/doc/developers/contributing.rst @@ -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 diff --git a/doc/developers/tips.rst b/doc/developers/tips.rst index 64efec199f95f..a83125aaf9321 100644 --- a/doc/developers/tips.rst +++ b/doc/developers/tips.rst @@ -61,6 +61,9 @@ integration, consider `this 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 ------------------------------- @@ -90,6 +93,19 @@ 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 exists on the first failed test + - ``--lf`` to rerun the tests that failed on the previous run + - ``-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 From ce35bcb064335da5942f64e1045214d93a4347b1 Mon Sep 17 00:00:00 2001 From: Nicolas Hug Date: Thu, 28 Mar 2019 09:28:08 -0400 Subject: [PATCH 2/3] Added --ff option --- doc/developers/tips.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/doc/developers/tips.rst b/doc/developers/tips.rst index a83125aaf9321..0278253448177 100644 --- a/doc/developers/tips.rst +++ b/doc/developers/tips.rst @@ -95,8 +95,9 @@ When a unit test fails, the following tricks can make debugging easier: Other `pytest` options that may become useful include: - - ``-x`` which exists on the first failed test + - ``-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, runnign 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 From c7640218d70cf5c3c5120bf5f79504cb02418502 Mon Sep 17 00:00:00 2001 From: Nicolas Hug Date: Thu, 28 Mar 2019 09:35:24 -0400 Subject: [PATCH 3/3] typo --- doc/developers/tips.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/developers/tips.rst b/doc/developers/tips.rst index 0278253448177..5f2c84f65dc33 100644 --- a/doc/developers/tips.rst +++ b/doc/developers/tips.rst @@ -97,7 +97,7 @@ 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, runnign the ones that failed first + - ``--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