Skip to content

Option --last-failed with all prior failures filtered runs no tests #4362

Open
@k-husmann

Description

@k-husmann

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    plugin: cacherelated to the cache builtin plugintopic: collectionrelated to the collection phasetopic: marksrelated to marks, either the general marks or builtin

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions