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

zope-testrunner should exit with a non-zero exit code if it fails to find any tests #77

Open
mgedmin opened this issue Oct 10, 2018 · 3 comments

Comments

@mgedmin
Copy link
Member

mgedmin commented Oct 10, 2018

It's very easy to get the options wrong and end up with zope-testrunner not finding any tests. In this situation zope-testrunner exits with 0, which means wrappers such as tox or Travis CI consider the test run to be successfull and show a nice green checkmark, misleading the user into thinking everything's fine.

We should consider not finding any tests at all to be an error condition and exit with a non-zero status.

@cjwatson
Copy link
Contributor

Can I suggest expanding this slightly? I think this should be done at the level of individual filters as well (e.g. -t or -m). This is because it's similarly easy to say something like zope.testrunner -t one-filter -t another-filter-with-a-typo and not notice that one of your filters has a typo, because after all you got some reasonable test output. IMO each filter should be required to match at least one test.

(If done correctly, this would also cover your request, because zope.testrunner defaults to something along the lines of -m . -t ..)

@cjwatson
Copy link
Contributor

On the other hand, my suggestion does seem rather more complicated to implement now that I look at it, because zope.testrunner builds a single filtering predicate from all the given filters, and without rearranging that there's no way for it to check that each individual filter matched something. So don't let me derail this issue.

@icemac
Copy link
Member

icemac commented Dec 2, 2020

I have been bitten by this problem in zopefoundation/bobo#14: Everything seemed fine but no test ran. 😢

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants