Merge "Fail tempest if 0 tests are run"

This commit is contained in:
Jenkins 2014-09-16 18:20:49 +00:00 committed by Gerrit Code Review
commit c6dac5315e
2 changed files with 5 additions and 2 deletions

View File

@ -76,7 +76,7 @@ class TestWrappers(base.TestCase):
# version or an sdist to work. so make the test directory a git repo # version or an sdist to work. so make the test directory a git repo
# too. # too.
subprocess.call(['git', 'init'], stderr=DEVNULL) subprocess.call(['git', 'init'], stderr=DEVNULL)
self.assertRunExit('pretty_tox.sh tests.passing', 0) self.assertRunExit('pretty_tox.sh passing', 0)
def test_pretty_tox_fails(self): def test_pretty_tox_fails(self):
# Git init is required for the pbr testr command. pbr requires a git # Git init is required for the pbr testr command. pbr requires a git
@ -86,7 +86,7 @@ class TestWrappers(base.TestCase):
self.assertRunExit('pretty_tox.sh', 1) self.assertRunExit('pretty_tox.sh', 1)
def test_pretty_tox_serial(self): def test_pretty_tox_serial(self):
self.assertRunExit('pretty_tox_serial.sh tests.passing', 0) self.assertRunExit('pretty_tox_serial.sh passing', 0)
def test_pretty_tox_serial_fails(self): def test_pretty_tox_serial_fails(self):
self.assertRunExit('pretty_tox_serial.sh', 1) self.assertRunExit('pretty_tox_serial.sh', 1)

View File

@ -234,6 +234,9 @@ def main():
stream.run(result) stream.run(result)
finally: finally:
result.stopTestRun() result.stopTestRun()
if count_tests('status', '.*') == 0:
print("The test run didn't actually run any tests")
return 1
if args.post_fails: if args.post_fails:
print_fails(sys.stdout) print_fails(sys.stdout)
print_summary(sys.stdout) print_summary(sys.stdout)