Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
k-husmann opened this issue Nov 9, 2018 · 3 comments
Open
Labels
plugin: cache related to the cache builtin plugin topic: collection related to the collection phase topic: marks related to marks, either the general marks or builtin

Comments

@k-husmann
Copy link

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.

@k-husmann k-husmann changed the title last-failed with markers or other filters Option --last-failed with all prior failures filtered runs no tests Nov 9, 2018
@RonnyPfannschmidt RonnyPfannschmidt added type: bug problem that needs to be addressed type: regression indicates a problem that was introduced in a release which was working previously labels Nov 9, 2018
@blueyed
Copy link
Contributor

blueyed commented Nov 13, 2018

@RonnyPfannschmidt
I do not think it is a regression, is it?

This is pytest version 3.8.2

Please try 3.10.1, just in case.

I actually like the current behavior more: with -m you limit the test collection already, and it should not cause tests to run that are not matching this.

@blueyed blueyed added topic: collection related to the collection phase topic: marks related to marks, either the general marks or builtin and removed type: regression indicates a problem that was introduced in a release which was working previously type: bug problem that needs to be addressed labels Nov 13, 2018
@k-husmann
Copy link
Author

I actually like the current behavior more: with -m you limit the test collection already, and it should not cause tests to run that are not matching this.

It is true, that tests filtered via -m switch should not (ever) be run. And that is not my request. Only that --lf, should run all-not-otherwise-filtered tests if it finds no last failed ones, after having applied the -m switch.

I'll build a test case for this and test it with 3.10.1 in my private environment as I cannot provide this during working hours/corporate environment. Expect an update within the next few days.

@blueyed
Copy link
Contributor

blueyed commented Apr 7, 2019

JFI: 1f5a61e improves the reporting/feedback, i.e. it should be easier to see what is going on (not released yet IIRC, but in the features branch).

@blueyed blueyed added the plugin: cache related to the cache builtin plugin label Apr 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
plugin: cache related to the cache builtin plugin topic: collection related to the collection phase topic: marks related to marks, either the general marks or builtin
Projects
None yet
Development

No branches or pull requests

3 participants