OLD | NEW |
---|---|
(Empty) | |
1 # Copyright 2014 The Chromium Authors. All rights reserved. | |
2 # Use of this source code is governed by a BSD-style license that can be | |
3 # found in the LICENSE file. | |
4 | |
5 import argparse | |
6 import os | |
7 import sys | |
8 import unittest | |
9 | |
10 from pylib import constants | |
11 | |
12 PYTHON_UNIT_TESTS = { | |
13 os.path.join(constants.DIR_SOURCE_ROOT, 'build', 'android'): [ | |
14 'pylib.device.device_utils_test', | |
15 ], | |
16 # 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
| |
17 # os.path.join(constants.DIR_SOURCE_ROOT, 'build', 'android', 'gyp'): [ | |
18 # 'java_cpp_enum_tests' | |
19 # ] | |
20 } | |
21 | |
22 | |
23 def main(): | |
24 | |
25 parser = argparse.ArgumentParser() | |
26 parser.add_argument('-v', '--verbose', action='count') | |
27 args = parser.parse_args() | |
28 | |
29 passed = True | |
30 | |
31 for path, modules in PYTHON_UNIT_TESTS.iteritems(): | |
32 sys.path = [path] + sys.path | |
33 try: | |
34 suite = unittest.TestSuite() | |
35 suite.addTests(unittest.defaultTestLoader.loadTestsFromName(m) | |
36 for m in modules) | |
37 runner = unittest.TextTestRunner(verbosity=args.verbose) | |
38 passed = (runner.run(suite).wasSuccessful() | |
39 and passed) | |
40 finally: | |
41 sys.path = sys.path[1:] | |
42 | |
43 return 0 if passed else 1 | |
44 | |
45 | |
46 if __name__ == '__main__': | |
47 sys.exit(main()) | |
48 | |
OLD | NEW |