Skip to content

Return value for --last-failed-no-failures none #7562

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

Closed
dimaqq opened this issue Jul 29, 2020 · 2 comments
Closed

Return value for --last-failed-no-failures none #7562

dimaqq opened this issue Jul 29, 2020 · 2 comments
Labels
type: question general question, might be closed after 2 weeks of inactivity

Comments

@dimaqq
Copy link

dimaqq commented Jul 29, 2020

More of a question / maybe behaviour change request:

> rm -rf .pytest_cache/
> pytest --last-failed --last-failed-no-failures none && echo OK || echo FAIL
...
run-last-failure: no previously failed tests, deselecting all items.
=== test session starts ===
...
=== 1915 deselected, 12 warnings in 1.69s ===
FAIL

Should pytest return 0, truthy to shell when no tests are ran as a result of --last-failed-no-failures none ?

@Zac-HD Zac-HD added the type: question general question, might be closed after 2 weeks of inactivity label Jul 29, 2020
@Zac-HD
Copy link
Member

Zac-HD commented Jul 29, 2020

See #2393 - failing (exit code 5) when no tests are run is the intended behaviour, to avoid 'missed alarms' where tests should fail but were not collected. We considered adding an option to disable this, but concluded that the complexity was better left to the invoking user or script - pytest has a lot of options already!

@Zac-HD Zac-HD closed this as completed Jul 29, 2020
@bsipocz
Copy link
Contributor

bsipocz commented Dec 17, 2024

I run into this very same issue, and now wonder what's the purpose of --last-failed-no-failures none if it will trigger the failing status in all the cases? I would consider this a bug for this option especially as the docs says:

pytest --last-failed --last-failed-no-failures none # runs no tests and exits successfully

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: question general question, might be closed after 2 weeks of inactivity
Projects
None yet
Development

No branches or pull requests

3 participants