test_all.py 607 B

12345678910111213141516171819202122232425
  1. #!/usr/bin/python
  2. """
  3. Copyright 2014 Google Inc.
  4. Use of this source code is governed by a BSD-style license that can be
  5. found in the LICENSE file.
  6. Run all unittests within this directory tree, recursing into subdirectories.
  7. """
  8. import os
  9. import unittest
  10. def main():
  11. suite = unittest.TestLoader().discover(os.path.dirname(__file__),
  12. pattern='*_test.py')
  13. results = unittest.TextTestRunner(verbosity=2).run(suite)
  14. print repr(results)
  15. if not results.wasSuccessful():
  16. raise Exception('failed one or more unittests')
  17. if __name__ == '__main__':
  18. main()