pylib/mercurial-support/silenttestrunner.py
author Gregory Szorc <gps@mozilla.com>
Tue, 12 Jan 2016 15:07:29 -0800
changeset 362099 64bc74f4b91a7730c7d03c4fcbe9f4a723813a75
parent 359535 6fe00a59b64d5706f262fcca94d097836e965b03
permissions -rw-r--r--
mozreview: copy more read-only processing code (bug 1229468); r=smacleod, dminor This is basically copying a lot of code from pushhooks.py. We don't yet make any database modification as part of this code. This just proves that a rough 1:1 copy continues to work.

import unittest, sys

def main(modulename):
    '''run the tests found in module, printing nothing when all tests pass'''
    module = sys.modules[modulename]
    suite = unittest.defaultTestLoader.loadTestsFromModule(module)
    results = unittest.TestResult()
    suite.run(results)
    if results.errors or results.failures:
        for tc, exc in results.errors:
            print 'ERROR:', tc
            print
            sys.stdout.write(exc)
        for tc, exc in results.failures:
            print 'FAIL:', tc
            print
            sys.stdout.write(exc)
        sys.exit(1)