Skip to content
Prev Previous commit
Next Next commit
docs: improve --lfnf docs to make functionality more clear
  • Loading branch information
seanjedi committed Aug 27, 2023
commit 66e7a1f6bfcf43e2bc0f724fbfed924af16c5d80
3 changes: 3 additions & 0 deletions doc/en/how-to/cache.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Copy link
Member

@nicoddemus nicoddemus Aug 28, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMHO this does not add much to what we already have above (and people found lacking in the first place).

Feel free to not only add to this section, but rewrite it entirely if you think it would be better.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

update the docs here: 75e815f


The new config.cache object
--------------------------------

Expand Down
5 changes: 4 additions & 1 deletion doc/en/reference/reference.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 4 additions & 1 deletion src/_pytest/cacheprovider.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please update this with the above suggestion.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

update the docs here: 75e815f

"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.",
)


Expand Down