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