tests/silenttestrunner.py
author Anton Shestakov <av6@dwimlabs.net>
Sun, 08 Apr 2018 20:53:07 +0800
changeset 37492 8d05938dd063
parent 28736 403b0a7ab410
child 43076 2372284d9457
permissions -rw-r--r--
hgweb: make followlines button absolutely positioned It used to have position: absolute only on annotate page, but it makes sense to have it everywhere, because the button shouldn't affect other elements at all. Especially since the button has a set height, which meant that for certain smaller fonts source lines were changing their height on hover. Note that the button doesn't set any of the usual properties that accompany absolute position (top, right, bottom or left). These properties would position the button without any account for source line padding. Instead, margins are used (the button already has all margins defined, they do the job).

from __future__ import absolute_import, print_function
import os
import sys
import unittest

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)

if os.environ.get('SILENT_BE_NOISY'):
    main = unittest.main