Unittest: Fail if zero tests were discovered

Thanks, I had searched and not found it, either :slight_smile:

My proposal would be to do it in unittest’s runner (the unittest.main module). I don’t think it really makes sense to do it in the test suite itself. The problem we are chasing is that we haven’t found the suite.

In the specific use-case for Debian, we would like to be able to have this behaviour at scale. Not be something we have to patch into every package’s test suite, separately. We have common code that most Python packages use to run their test suites, so we could make that pass an extra argument. Packages without test suites that are currently running 0 tests successfully would have to explicitly disable tests, which seems like the right way to go, these days. I guess we could also look at changing our default test runner from unittest to pytest, to achieve this, but that brings in extra dependencies, at build time, everywhere, which isn’t great.

1 Like