From 66e7a1f6bfcf43e2bc0f724fbfed924af16c5d80 Mon Sep 17 00:00:00 2001 From: Sean Malloy Date: Sun, 27 Aug 2023 15:26:42 -0700 Subject: [PATCH] docs: improve --lfnf docs to make functionality more clear --- doc/en/how-to/cache.rst | 3 +++ doc/en/reference/reference.rst | 5 ++++- src/_pytest/cacheprovider.py | 5 ++++- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/doc/en/how-to/cache.rst b/doc/en/how-to/cache.rst index 8554a984c..c9b15f35f 100644 --- a/doc/en/how-to/cache.rst +++ b/doc/en/how-to/cache.rst @@ -185,6 +185,9 @@ using the ``--last-failed-no-failures`` option, which takes one of the following pytest --last-failed --last-failed-no-failures all # run all tests (default behavior) pytest --last-failed --last-failed-no-failures none # run no tests and exit +The ``--last-failed-no-failures`` option governs the behavior of ``--if``. +Default ``all`` runs all tests with no known failures. ``none`` avoids tests and exits successfully when there are no known failures. + The new config.cache object -------------------------------- diff --git a/doc/en/reference/reference.rst b/doc/en/reference/reference.rst index 11da87651..847500ec9 100644 --- a/doc/en/reference/reference.rst +++ b/doc/en/reference/reference.rst @@ -1894,7 +1894,10 @@ All the command-line flags can be obtained by running ``pytest --help``:: --lfnf={all,none}, --last-failed-no-failures={all,none} Determines whether to execute tests when there are no previously (known) failures or when no - cached ``lastfailed`` data was found + cached ``lastfailed`` data was found. + This option governs the behavior of ``--if``. + Default ``all`` runs all tests with no known failures. + ``none`` avoids tests and exits if no failures. --sw, --stepwise Exit on test failure and continue from last failing test next time --sw-skip, --stepwise-skip diff --git a/src/_pytest/cacheprovider.py b/src/_pytest/cacheprovider.py index 6d61c0dd0..7f19e845f 100755 --- a/src/_pytest/cacheprovider.py +++ b/src/_pytest/cacheprovider.py @@ -500,7 +500,10 @@ def pytest_addoption(parser: Parser) -> None: choices=("all", "none"), default="all", help="Determines whether to execute tests when there are no previously (known)" - "failures or when no cached ``lastfailed`` data was found", + "failures or when no cached ``lastfailed`` data was found." + "This option governs the behavior of ``--if``." + "Default ``all`` runs all tests with no known failures." + "``none`` avoids tests and exits if no failures.", )