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