1.9.30 sync.
[gae.git] / python / run_tests.py
blob0b263e9ecc3229366b1f52f913ae39014615f8a8
1 #!/usr/bin/env python
3 # Copyright 2007 Google Inc.
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
9 # http://www.apache.org/licenses/LICENSE-2.0
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
17 """Runs the unit test suite for devappserver2."""
21 import argparse
22 import cStringIO
23 import logging
24 import os.path
25 import random
26 import sys
27 import unittest
29 DIR_PATH = os.path.dirname(__file__)
31 TEST_LIBRARY_PATHS = [
32 DIR_PATH,
33 os.path.join(DIR_PATH, 'lib', 'cherrypy'),
34 os.path.join(DIR_PATH, 'lib', 'fancy_urllib'),
35 os.path.join(DIR_PATH, 'lib', 'yaml-3.10'),
36 os.path.join(DIR_PATH, 'lib', 'antlr3'),
37 os.path.join(DIR_PATH, 'lib', 'concurrent'),
38 os.path.join(DIR_PATH, 'lib', 'ipaddr'),
39 os.path.join(DIR_PATH, 'lib', 'jinja2-2.6'),
40 os.path.join(DIR_PATH, 'lib', 'webob-1.2.3'),
41 os.path.join(DIR_PATH, 'lib', 'webapp2-2.5.1'),
42 os.path.join(DIR_PATH, 'lib', 'mox'),
43 os.path.join(DIR_PATH, 'lib', 'protorpc-1.0'),
47 def main():
48 sys.path.extend(TEST_LIBRARY_PATHS)
50 parser = argparse.ArgumentParser(
51 description='Run the devappserver2 test suite.')
52 parser.add_argument(
53 'tests', nargs='*',
54 help='The fully qualified names of the tests to run (e.g. '
55 'google.appengine.tools.devappserver2.api_server_test). If not given '
56 'then the full test suite will be run.')
58 args = parser.parse_args()
60 loader = unittest.TestLoader()
61 if args.tests:
62 tests = loader.loadTestsFromNames(args.tests)
63 else:
64 tests = loader.discover(
65 os.path.join(DIR_PATH, 'google/appengine/tools/devappserver2'),
66 '*_test.py')
68 runner = unittest.TextTestRunner(verbosity=2)
69 runner.run(tests)
71 if __name__ == '__main__':
72 main()