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.
176
176
Behavior when no tests failed in the last run
177
177
---------------------------------------------
178
178
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:
182
189
183
190
.. code-block :: bash
184
191
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
187
194
188
195
The new config.cache object
189
196
--------------------------------
Original file line number Diff line number Diff line change @@ -1892,8 +1892,11 @@ All the command-line flags can be obtained by running ``pytest --help``::
1892
1892
tests. Optional argument: glob (default: '*').
1893
1893
--cache-clear Remove all cache contents at start of test run
1894
1894
--lfnf={all,none}, --last-failed-no-failures={all,none}
1895
- Which tests to run with no previously (known)
1896
- failures
1895
+ With ``--lf``, determines whether to execute tests when there
1896
+ are no previously (known) failures or when no
1897
+ cached ``lastfailed`` data was found.
1898
+ ``all`` (the default) runs the full test suite again.
1899
+ ``none`` just emits a message about no known failures and exits successfully.
1897
1900
--sw, --stepwise Exit on test failure and continue from last failing
1898
1901
test next time
1899
1902
--sw-skip, --stepwise-skip
Original file line number Diff line number Diff line change @@ -499,7 +499,11 @@ def pytest_addoption(parser: Parser) -> None:
499
499
dest = "last_failed_no_failures" ,
500
500
choices = ("all" , "none" ),
501
501
default = "all" ,
502
- help = "Which tests to run with no previously (known) failures" ,
502
+ help = "With ``--lf``, determines whether to execute tests when there "
503
+ "are no previously (known) failures or when no "
504
+ "cached ``lastfailed`` data was found. "
505
+ "``all`` (the default) runs the full test suite again. "
506
+ "``none`` just emits a message about no known failures and exits successfully." ,
503
507
)
504
508
505
509
You can’t perform that action at this time.
0 commit comments