Revision created by MOE tool push_codebase.
[gae.git] / python / run_tests.py
blobf05c059b17002ca69a929189e1ed0dc369d9e11d
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."""
20 import argparse
21 import cStringIO
22 import logging
23 import os.path
24 import random
25 import sys
26 import unittest
28 DIR_PATH = os.path.dirname(__file__)
30 TEST_LIBRARY_PATHS = [
31 DIR_PATH,
32 os.path.join(DIR_PATH, 'lib', 'cherrypy'),
33 os.path.join(DIR_PATH, 'lib', 'fancy_urllib'),
34 os.path.join(DIR_PATH, 'lib', 'yaml-3.10'),
35 os.path.join(DIR_PATH, 'lib', 'antlr3'),
36 os.path.join(DIR_PATH, 'lib', 'concurrent'),
37 os.path.join(DIR_PATH, 'lib', 'ipaddr'),
38 os.path.join(DIR_PATH, 'lib', 'jinja2-2.6'),
39 os.path.join(DIR_PATH, 'lib', 'webob-1.2.3'),
40 os.path.join(DIR_PATH, 'lib', 'webapp2-2.5.1'),
41 os.path.join(DIR_PATH, 'lib', 'mox'),
42 os.path.join(DIR_PATH, 'lib', 'protorpc-1.0'),
46 def main():
47 sys.path.extend(TEST_LIBRARY_PATHS)
49 parser = argparse.ArgumentParser(
50 description='Run the devappserver2 test suite.')
51 parser.add_argument(
52 'tests', nargs='*',
53 help='The fully qualified names of the tests to run (e.g. '
54 'google.appengine.tools.devappserver2.api_server_test). If not given '
55 'then the full test suite will be run.')
57 args = parser.parse_args()
59 loader = unittest.TestLoader()
60 if args.tests:
61 tests = loader.loadTestsFromNames(args.tests)
62 else:
63 tests = loader.discover(
64 os.path.join(DIR_PATH, 'google/appengine/tools/devappserver2'),
65 '*_test.py')
67 runner = unittest.TextTestRunner(verbosity=2)
68 runner.run(tests)
70 if __name__ == '__main__':
71 main()