run_tests 747 B

12345678910111213141516171819202122232425
  1. #!/usr/bin/env vpython3
  2. # Copyright 2014 The Chromium Authors. All rights reserved.
  3. # Use of this source code is governed by a BSD-style license that can be
  4. # found in the LICENSE file.
  5. import logging
  6. import os
  7. import sys
  8. import unittest
  9. if __name__ == '__main__':
  10. logging.basicConfig(
  11. level=logging.DEBUG if '-v' in sys.argv else logging.WARNING,
  12. format='%(levelname)5s %(filename)15s(%(lineno)3d): %(message)s')
  13. suite = unittest.TestSuite()
  14. loader = unittest.TestLoader()
  15. suite.addTests(loader.discover(start_dir=os.path.dirname(__file__),
  16. pattern='*_unittest.py'))
  17. res = unittest.TextTestRunner(verbosity=2).run(suite)
  18. if res.wasSuccessful():
  19. sys.exit(0)
  20. else:
  21. sys.exit(1)