-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
fail on zero tests found #662
Comments
Original comment by holger krekel (BitBucket: hpk42, GitHub: hpk42): Not sure. Maybe post to the pytest-dev mailing list to discuss the case of "no tests run" or "no tests collected"? For me, it might be ok if a test run where no tests are run results in != 0 return code. Question is if there is a case where this would be unwanted. In general we try to minimize the number of command line options. |
There's a pull request in #817 now. |
Hi People, I think it seems to be a bug here: _pytest/main.py:614..620: |
@vladyslav-savchenko that is intentional - passing missing files is a usage error, passing test filters that cause no tests to be is the notestscollected error |
No, files exist, I have checked that with os.path.exists. I have found the cause of this wrong behavior here (_pytest/python.py:154). I get an exit code 4 if a python source does not have an extension at all. I think it is not completely correct to detect if it is a python source just checking for its extension. Not every python script has such one, but command Unfortunately I can not suggest a better solution yet :- ( Thank you! |
Can you provide a reproducible minimal case? If so feel free to open a new issue to discuss your problem. |
Originally reported by: Boris Rybalkin (BitBucket: cyberb, GitHub: cyberb)
Sometimes it is critical to fail when py.test does not find any test. This may happen when you are accidentally running in the wrong directory on the build agent and may lead to the impression that everything is ok.
Something like:
py.test --fail-on-empy
EDIT: fail by default would be even better
The text was updated successfully, but these errors were encountered: