Fail if number of excuted tests != number of dicovered tests

this will report failing status in CI in case we have the
'Ran 0 tests in 46.486s' scenario.

Note: the check is placed after runner.run() to present the
message shown above which should make it more clear what went on.

Related: rhbz#1698366

0 run
This commit is contained in:
Alexander Todorov 2019-07-04 13:11:03 +03:00 committed by Alexander Todorov
parent 9bce583fc2
commit 0777e91d52

View File

@ -132,4 +132,8 @@ def main():
runner = unittest.TextTestRunner(verbosity=2, failfast=args.sit) runner = unittest.TextTestRunner(verbosity=2, failfast=args.sit)
result = runner.run(tests) result = runner.run(tests)
if tests.countTestCases() != result.testsRun:
print("Error: unexpected number of tests were run", file=sys.stderr)
sys.exit(1)
sys.exit(not result.wasSuccessful()) sys.exit(not result.wasSuccessful())