[7.4.x] Issue 11354 fixing docs for lfnf (#11364) · pytest-dev/pytest@b170081 (original) (raw)
3 files changed
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 |
---|---|---|
@@ -1887,8 +1887,11 @@ All the command-line flags can be obtained by running ``pytest --help``:: | ||
1887 | 1887 | tests. Optional argument: glob (default: '*'). |
1888 | 1888 | --cache-clear Remove all cache contents at start of test run |
1889 | 1889 | --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. | |
1892 | 1895 | --sw, --stepwise Exit on test failure and continue from last failing |
1893 | 1896 | test next time |
1894 | 1897 | --sw-skip, --stepwise-skip |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -505,7 +505,11 @@ def pytest_addoption(parser: Parser) -> None: | ||
505 | 505 | dest="last_failed_no_failures", |
506 | 506 | choices=("all", "none"), |
507 | 507 | 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.", | |
509 | 513 | ) |
510 | 514 | |
511 | 515 |