Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 #!/usr/bin/python | |
| 2 # Copyright 2013 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 | |
| 6 import optparse | |
| 7 import os | |
| 8 import sys | |
| 9 import unittest | |
| 10 | |
|
Dai Mikurube (NOT FULLTIME)
2013/09/24 07:22:11
One more empty line.
junjianx
2013/09/24 08:11:21
Done.
| |
| 11 USAGE = """%prog SDK_PATH | |
| 12 Run unit tests for App Engine apps. | |
| 13 SDK_PATH Path to the google_appengine installation""" | |
| 14 | |
| 15 | |
| 16 def main(sdk_path): | |
| 17 sys.path.insert(0, sdk_path) | |
| 18 import dev_appserver | |
| 19 dev_appserver.fix_sys_path() | |
| 20 path = os.path.dirname(os.path.abspath(__file__)) | |
| 21 suite = unittest.loader.TestLoader().discover( | |
| 22 path, | |
| 23 pattern='*_unittest.py' | |
| 24 ) | |
| 25 unittest.TextTestRunner(verbosity=2).run(suite) | |
| 26 | |
| 27 | |
| 28 if __name__ == '__main__': | |
|
Dai Mikurube (NOT FULLTIME)
2013/09/24 07:22:11
This clause should be simpler, just calling main()
junjianx
2013/09/24 08:11:21
Done.
| |
| 29 parser = optparse.OptionParser(USAGE) | |
| 30 options, args = parser.parse_args() | |
| 31 if len(args) != 1: | |
| 32 print 'Error: Exactly 1 arguments required.' | |
| 33 parser.print_help() | |
| 34 sys.exit(1) | |
| 35 SDK_PATH = args[0] | |
| 36 main(SDK_PATH) | |
| OLD | NEW |