Chromium Code Reviews| Index: build/android/python_test_runner.py |
| diff --git a/build/android/python_test_runner.py b/build/android/python_test_runner.py |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..2f7433305e54e8d86905db1c818b23ca38eaaca3 |
| --- /dev/null |
| +++ b/build/android/python_test_runner.py |
| @@ -0,0 +1,48 @@ |
| +# Copyright 2014 The Chromium Authors. All rights reserved. |
| +# Use of this source code is governed by a BSD-style license that can be |
| +# found in the LICENSE file. |
| + |
| +import argparse |
| +import os |
| +import sys |
| +import unittest |
| + |
| +from pylib import constants |
| + |
| +PYTHON_UNIT_TESTS = { |
| + os.path.join(constants.DIR_SOURCE_ROOT, 'build', 'android'): [ |
| + 'pylib.device.device_utils_test', |
| + ], |
| + # TODO(mkosiba): Reenable after fixing these. |
|
klundberg
2014/10/16 17:50:15
This seems a bit weird in a new file (the "reenabl
jbudorick
2014/10/16 17:55:07
Hah, no. This CL was motivated by an offline conve
|
| + # os.path.join(constants.DIR_SOURCE_ROOT, 'build', 'android', 'gyp'): [ |
| + # 'java_cpp_enum_tests' |
| + # ] |
| +} |
| + |
| + |
| +def main(): |
| + |
| + parser = argparse.ArgumentParser() |
| + parser.add_argument('-v', '--verbose', action='count') |
| + args = parser.parse_args() |
| + |
| + passed = True |
| + |
| + for path, modules in PYTHON_UNIT_TESTS.iteritems(): |
| + sys.path = [path] + sys.path |
| + try: |
| + suite = unittest.TestSuite() |
| + suite.addTests(unittest.defaultTestLoader.loadTestsFromName(m) |
| + for m in modules) |
| + runner = unittest.TextTestRunner(verbosity=args.verbose) |
| + passed = (runner.run(suite).wasSuccessful() |
| + and passed) |
| + finally: |
| + sys.path = sys.path[1:] |
| + |
| + return 0 if passed else 1 |
| + |
| + |
| +if __name__ == '__main__': |
| + sys.exit(main()) |
| + |