pytest-dev / pytest-dev/pytest
Option --last-failed with all prior failures filtered runs no tests
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 14.5k
- Forks
- 3.4k
- Avg merge
- 2d 9h
- Merged PRs (30d)
- 35
Description
When using --last-failed and there are no last failures, per default and as documented, all tests should run. That works fine unless combined with markers, if those filter all prior failures -> then it runs no tests. It would be more convenient if that could be detected, i.e. if all prior failures are filtered --lf should behave as if there had been NO last failures => rerun all.
pseudo - example:
$ pytest
... 1 test fails, which is marked 'bad'
... make some changes that will also fail another test 'later_bad'
pytest --lf -m 'not bad'
... no tests are run, later_bad is not detected
... wanted behaviour: realize that all last failed are filtered => rerun all not-filtered tests, i.e. as without --lf
As a workaround I use:
pytest --lf -m 'not bad'
if [ "$?" == 5 ]; then pytest -m 'not bad'
I am running pytest under Cygwin, and that is my version:
$ pytest --version
This is pytest version 3.8.2, imported from /usr/lib/python3.6/site-packages/pytest.py
setuptools registered plugins:
pytest-cov-2.6.0 at /usr/lib/python3.6/site-packages/pytest_cov/plugin.py
PARSEER <class '_pytest.config.argparsing.Parser'>
Btw, thanks for the good work, pytest is great! If you are interested in my upgrade-feature request, I happily provide a full test case with py-code and shell script.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the reported pytest --lf -m 'not bad' behavior using the command-line options described in the issue. Trace how last-failed selection interacts with marker filtering, and verify that when every prior failure is filtered, the command runs all remaining tests as a normal run would.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- cli, testing
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100