OLD | NEW |
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 """Runs the Python tests (relies on using the Java test runner).""" | 5 """Runs the Python tests (relies on using the Java test runner).""" |
6 | 6 |
7 import logging | 7 import logging |
8 import os | 8 import os |
9 import sys | 9 import sys |
10 import types | 10 import types |
11 | 11 |
12 from pylib import android_commands | 12 from pylib import android_commands |
13 from pylib import constants | 13 from pylib import constants |
14 from pylib.base.test_result import TestResults | 14 from pylib.base import base_test_result |
15 from pylib.instrumentation import test_package | 15 from pylib.instrumentation import test_package |
16 from pylib.instrumentation import test_runner | 16 from pylib.instrumentation import test_runner |
17 | 17 |
18 import python_test_base | 18 import python_test_base |
19 from python_test_caller import CallPythonTest | 19 from python_test_caller import CallPythonTest |
20 from python_test_sharder import PythonTestSharder | 20 from python_test_sharder import PythonTestSharder |
21 from test_info_collection import TestInfoCollection | 21 from test_info_collection import TestInfoCollection |
22 | 22 |
23 | 23 |
24 def _GetPythonFiles(root, files): | 24 def _GetPythonFiles(root, files): |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 all_tests = _GetAllTests(options.python_test_root, options.official_build) | 68 all_tests = _GetAllTests(options.python_test_root, options.official_build) |
69 test_collection.AddTests(all_tests) | 69 test_collection.AddTests(all_tests) |
70 test_names = [t.qualified_name for t in all_tests] | 70 test_names = [t.qualified_name for t in all_tests] |
71 logging.debug('All available tests: ' + str(test_names)) | 71 logging.debug('All available tests: ' + str(test_names)) |
72 | 72 |
73 available_tests = test_collection.GetAvailableTests( | 73 available_tests = test_collection.GetAvailableTests( |
74 options.annotation, options.test_filter) | 74 options.annotation, options.test_filter) |
75 | 75 |
76 if not available_tests: | 76 if not available_tests: |
77 logging.warning('No Python tests to run with current args.') | 77 logging.warning('No Python tests to run with current args.') |
78 return TestResults() | 78 return base_test_result.TestRunResults() |
79 | 79 |
80 available_tests *= options.number_of_runs | 80 available_tests *= options.number_of_runs |
81 test_names = [t.qualified_name for t in available_tests] | 81 test_names = [t.qualified_name for t in available_tests] |
82 logging.debug('Final list of tests to run: ' + str(test_names)) | 82 logging.debug('Final list of tests to run: ' + str(test_names)) |
83 | 83 |
84 # Copy files to each device before running any tests. | 84 # Copy files to each device before running any tests. |
85 for device_id in attached_devices: | 85 for device_id in attached_devices: |
86 logging.debug('Pushing files to device %s', device_id) | 86 logging.debug('Pushing files to device %s', device_id) |
87 test_pkg = test_package.TestPackage(options.test_apk_path, | 87 test_pkg = test_package.TestPackage(options.test_apk_path, |
88 options.test_apk_jar_path) | 88 options.test_apk_jar_path) |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 Returns: | 199 Returns: |
200 List of test case objects for all available test methods. | 200 List of test case objects for all available test methods. |
201 """ | 201 """ |
202 if not test_root: | 202 if not test_root: |
203 return [] | 203 return [] |
204 all_tests = [] | 204 all_tests = [] |
205 test_module_list = _GetTestModules(test_root, is_official_build) | 205 test_module_list = _GetTestModules(test_root, is_official_build) |
206 for module in test_module_list: | 206 for module in test_module_list: |
207 all_tests.extend(_GetTestClassesFromModule(module)) | 207 all_tests.extend(_GetTestClassesFromModule(module)) |
208 return all_tests | 208 return all_tests |
OLD | NEW |