tests/silenttestrunner.py
changeset 43076 2372284d9457
parent 28736 403b0a7ab410
child 48875 6000f5b25c9b
equal deleted inserted replaced
43075:57875cf423c9 43076:2372284d9457
     1 from __future__ import absolute_import, print_function
     1 from __future__ import absolute_import, print_function
     2 import os
     2 import os
     3 import sys
     3 import sys
     4 import unittest
     4 import unittest
       
     5 
     5 
     6 
     6 def main(modulename):
     7 def main(modulename):
     7     '''run the tests found in module, printing nothing when all tests pass'''
     8     '''run the tests found in module, printing nothing when all tests pass'''
     8     module = sys.modules[modulename]
     9     module = sys.modules[modulename]
     9     suite = unittest.defaultTestLoader.loadTestsFromModule(module)
    10     suite = unittest.defaultTestLoader.loadTestsFromModule(module)
    18             print('FAIL:', tc)
    19             print('FAIL:', tc)
    19             print()
    20             print()
    20             sys.stdout.write(exc)
    21             sys.stdout.write(exc)
    21         sys.exit(1)
    22         sys.exit(1)
    22 
    23 
       
    24 
    23 if os.environ.get('SILENT_BE_NOISY'):
    25 if os.environ.get('SILENT_BE_NOISY'):
    24     main = unittest.main
    26     main = unittest.main