Joe Gregorio | 48d361f | 2010-08-18 13:19:21 -0400 | [diff] [blame] | 1 | #!/usr/bin/env python |
Joe Gregorio | 68a8cfe | 2012-08-03 16:17:40 -0400 | [diff] [blame^] | 2 | import gflags |
Joe Gregorio | fe695fb | 2010-08-30 12:04:04 -0400 | [diff] [blame] | 3 | import glob |
Joe Gregorio | 8b4c173 | 2011-12-06 11:28:29 -0500 | [diff] [blame] | 4 | import imp |
Joe Gregorio | fe695fb | 2010-08-30 12:04:04 -0400 | [diff] [blame] | 5 | import logging |
| 6 | import os |
| 7 | import sys |
| 8 | import unittest |
Joe Gregorio | 68a8cfe | 2012-08-03 16:17:40 -0400 | [diff] [blame^] | 9 | |
| 10 | # import oauth2client.util for its gflags. |
| 11 | import oauth2client.util |
| 12 | |
Joe Gregorio | 48d361f | 2010-08-18 13:19:21 -0400 | [diff] [blame] | 13 | from trace import fullmodname |
Joe Gregorio | 48d361f | 2010-08-18 13:19:21 -0400 | [diff] [blame] | 14 | |
Joe Gregorio | e84c944 | 2012-03-12 08:45:57 -0400 | [diff] [blame] | 15 | logging.basicConfig(level=logging.CRITICAL) |
| 16 | |
Joe Gregorio | 68a8cfe | 2012-08-03 16:17:40 -0400 | [diff] [blame^] | 17 | FLAGS = gflags.FLAGS |
| 18 | |
Joe Gregorio | 432f17e | 2011-05-22 23:18:00 -0400 | [diff] [blame] | 19 | APP_ENGINE_PATH='../google_appengine' |
| 20 | |
ade@google.com | 6e54a91 | 2010-12-10 22:26:04 +0000 | [diff] [blame] | 21 | # Conditional import of cleanup function |
| 22 | try: |
| 23 | from tests.utils import cleanup |
| 24 | except: |
| 25 | def cleanup(): |
| 26 | pass |
| 27 | |
| 28 | # Ensure current working directory is in path |
Joe Gregorio | 48d361f | 2010-08-18 13:19:21 -0400 | [diff] [blame] | 29 | sys.path.insert(0, os.getcwd()) |
Joe Gregorio | 432f17e | 2011-05-22 23:18:00 -0400 | [diff] [blame] | 30 | sys.path.insert(0, APP_ENGINE_PATH) |
Joe Gregorio | 48d361f | 2010-08-18 13:19:21 -0400 | [diff] [blame] | 31 | |
Joe Gregorio | f42dfdc | 2011-10-14 13:55:24 -0400 | [diff] [blame] | 32 | from google.appengine.dist import use_library |
| 33 | use_library('django', '1.2') |
| 34 | |
| 35 | |
Joe Gregorio | 68a8cfe | 2012-08-03 16:17:40 -0400 | [diff] [blame^] | 36 | def main(argv): |
| 37 | argv = FLAGS(argv) |
| 38 | for t in argv[1:]: |
Joe Gregorio | 08cdcb8 | 2012-03-14 00:09:33 -0400 | [diff] [blame] | 39 | module = imp.load_source('test', t) |
| 40 | test = unittest.TestLoader().loadTestsFromModule(module) |
| 41 | result = unittest.TextTestRunner(verbosity=1).run(test) |
Joe Gregorio | b843fa2 | 2010-12-13 16:26:07 -0500 | [diff] [blame] | 42 | |
ade@google.com | 6e54a91 | 2010-12-10 22:26:04 +0000 | [diff] [blame] | 43 | |
| 44 | if __name__ == '__main__': |
Joe Gregorio | 68a8cfe | 2012-08-03 16:17:40 -0400 | [diff] [blame^] | 45 | main(sys.argv) |