"""Test runner which suppresses error output but emits a status dot per test. Used when creating a PGO build of Python where error results do not matter. """ import os.path import test.support import unittest def main(start_dir=os.path.dirname(__file__)): original_verbosity = test.support.verbose # Verbosity must be set before any test file is imported, else module-level # statements that are guarded with a verbosity check will still print out # information. test.support.verbose = 0 # XXX Override sys.stderr with some blackhole object? try: total_test_suite = unittest.defaultTestLoader.discover(start_dir) for test_suite in total_test_suite: for single_test in test_suite: # Results are unimportant, so just use a throw-away # TestResult instance. single_test.run(unittest.TestResult()) print('.', end='', flush=True) finally: test.support.verbose = original_verbosity print() if __name__ == '__main__': main()