File tree Expand file tree Collapse file tree 3 files changed +22
-8
lines changed Expand file tree Collapse file tree 3 files changed +22
-8
lines changed Original file line number Diff line number Diff line change @@ -176,14 +176,21 @@ with more recent files coming first.
176176Behavior when no tests failed in the last run
177177---------------------------------------------
178178
179- When no tests failed in the last run, or when no cached ``lastfailed `` data was
180- found, ``pytest `` can be configured either to run all of the tests or no tests,
181- using the ``--last-failed-no-failures `` option, which takes one of the following values:
179+ The ``--lfnf/--last-failed-no-failures `` option governs the behavior of ``--last-failed ``.
180+ Determines whether to execute tests when there are no previously (known)
181+ failures or when no cached ``lastfailed `` data was found.
182+
183+ There are two options:
184+
185+ * ``all ``: when there are no known test failures, runs all tests (the full test suite). This is the default.
186+ * ``none ``: when there are no known test failures, just emits a message stating this and exit successfully.
187+
188+ Example:
182189
183190.. code-block :: bash
184191
185- pytest --last-failed --last-failed-no-failures all # run all tests (default behavior)
186- pytest --last-failed --last-failed-no-failures none # run no tests and exit
192+ pytest --last-failed --last-failed-no-failures all # runs the full test suite (default behavior)
193+ pytest --last-failed --last-failed-no-failures none # runs no tests and exits successfully
187194
188195 The new config.cache object
189196--------------------------------
Original file line number Diff line number Diff line change @@ -1887,8 +1887,11 @@ All the command-line flags can be obtained by running ``pytest --help``::
18871887 tests. Optional argument: glob (default: '*').
18881888 --cache-clear Remove all cache contents at start of test run
18891889 --lfnf={all,none}, --last-failed-no-failures={all,none}
1890- Which tests to run with no previously (known)
1891- failures
1890+ With ``--lf``, determines whether to execute tests when there
1891+ are no previously (known) failures or when no
1892+ cached ``lastfailed`` data was found.
1893+ ``all`` (the default) runs the full test suite again.
1894+ ``none`` just emits a message about no known failures and exits successfully.
18921895 --sw, --stepwise Exit on test failure and continue from last failing
18931896 test next time
18941897 --sw-skip, --stepwise-skip
Original file line number Diff line number Diff line change @@ -505,7 +505,11 @@ def pytest_addoption(parser: Parser) -> None:
505505 dest = "last_failed_no_failures" ,
506506 choices = ("all" , "none" ),
507507 default = "all" ,
508- help = "Which tests to run with no previously (known) failures" ,
508+ help = "With ``--lf``, determines whether to execute tests when there "
509+ "are no previously (known) failures or when no "
510+ "cached ``lastfailed`` data was found. "
511+ "``all`` (the default) runs the full test suite again. "
512+ "``none`` just emits a message about no known failures and exits successfully." ,
509513 )
510514
511515
You can’t perform that action at this time.
0 commit comments