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

Override pytest's exit code 5 for "no tests were run" #31

Closed
blueyed opened this issue Dec 16, 2015 · 10 comments
Closed

Override pytest's exit code 5 for "no tests were run" #31

blueyed opened this issue Dec 16, 2015 · 10 comments
Assignees

Comments

@blueyed
Copy link
Contributor

blueyed commented Dec 16, 2015

py.test will exit with code 5 in case no tests were ran (pytest-dev/pytest#812, pytest-dev/pytest#500 (comment)).

I can see that this is useful in general, but with pytest-testmon this should not be an error.

Would it be possible and is it sensible to override pytest's exit code to be 0 in that case then?

My use case it using pytest-watch and its --onfail feature, which should not be triggered because testmon made py.test skip all tests.

blueyed added a commit to blueyed/pytest-watch that referenced this issue Dec 16, 2015
py.test returns exit code 5 in case no tests are run/collected.
This can happen with tools like pytest-testmon.

Ref: pytest-dev/pytest#812
Ref: tarpas/pytest-testmon#31
@tarpas
Copy link
Owner

tarpas commented Dec 17, 2015

Yeah, I understand the use case. This would idally by done by storing the
results from previous run and returning a union of stored and new test
results (the proper exit code would be produced automatically)

On Wed, Dec 16, 2015 at 9:15 PM, Daniel Hahler notifications@github.com
wrote:

py.test will exit with code 5 in case no tests were ran (
pytest-dev/pytest#812 pytest-dev/pytest#812, pytest-dev/pytest#500
(comment)
pytest-dev/pytest#500 (comment)).

I can see that this is useful in general, but with pytest-testmon this
should not be an error.

Would it be possible and is it sensible to override pytest's exit code to
be 0 in that case then?

My use case it using pytest-watch and its --onfail feature, which should
not be triggered because testmon made py.test skip all tests.


Reply to this email directly or view it on GitHub
#31.

@blueyed
Copy link
Contributor Author

blueyed commented Mar 25, 2016

@tarpas
Any update on this?
Can you provide more hints to fix this?

While pytest-watch has a patch by now that handles it, it's still an issue when running py.test --testmon with other tools.

@tarpas
Copy link
Owner

tarpas commented May 17, 2016

This is going to be implemented via #13

@tarpas tarpas closed this as completed May 17, 2016
@tarpas
Copy link
Owner

tarpas commented May 17, 2016

@blueyed Do you want to take a stab on it?

@blueyed
Copy link
Contributor Author

blueyed commented May 17, 2016

@tarpas
Thanks for the offer and notification, but that's too much for me currently.
Maybe that would be a good topic for the pytest sprint!?
Also the whole topic of making this a first-class pytest plugin.
Are you coming?

@boxed
Copy link
Contributor

boxed commented Aug 25, 2017

Why is this ticket closed? I just now was hit by this and had to make a workaround... Have I done something wrong or do I need to do something different?

@automaticgiant
Copy link

what was your workaround @boxed ?

@boxed
Copy link
Contributor

boxed commented Aug 23, 2018

My workaround was to make my program explicitly know about this exit code and treat it as zero if testmon is in use.

@tarpas
Copy link
Owner

tarpas commented Aug 23, 2018

This was closed because I thought #13 fixes it, sorry.

@tarpas tarpas reopened this Aug 23, 2018
tarpas added a commit that referenced this issue May 3, 2019
@tarpas
Copy link
Owner

tarpas commented Mar 1, 2022

Fixed in v 1.3.0.

@tarpas tarpas closed this as completed Mar 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants