| 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 |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 | 98 |
| 99 # Actually run the tests. | 99 # Actually run the tests. |
| 100 if len(attached_devices) > 1 and options.wait_for_debugger: | 100 if len(attached_devices) > 1 and options.wait_for_debugger: |
| 101 logging.warning('Debugger can not be sharded, ' | 101 logging.warning('Debugger can not be sharded, ' |
| 102 'using first available device') | 102 'using first available device') |
| 103 attached_devices = attached_devices[:1] | 103 attached_devices = attached_devices[:1] |
| 104 logging.debug('Running Python tests') | 104 logging.debug('Running Python tests') |
| 105 sharder = PythonTestSharder(attached_devices, available_tests, options) | 105 sharder = PythonTestSharder(attached_devices, available_tests, options) |
| 106 test_results = sharder.RunShardedTests() | 106 test_results = sharder.RunShardedTests() |
| 107 | 107 |
| 108 return test_results | 108 if not test_results.DidRunPass(): |
| 109 return (test_results, 1) |
| 110 |
| 111 return (test_results, 0) |
| 109 | 112 |
| 110 | 113 |
| 111 def _GetTestModules(python_test_root, is_official_build): | 114 def _GetTestModules(python_test_root, is_official_build): |
| 112 """Retrieve a sorted list of pythonDrivenTests. | 115 """Retrieve a sorted list of pythonDrivenTests. |
| 113 | 116 |
| 114 Walks the location of pythonDrivenTests, imports them, and provides the list | 117 Walks the location of pythonDrivenTests, imports them, and provides the list |
| 115 of imported modules to the caller. | 118 of imported modules to the caller. |
| 116 | 119 |
| 117 Args: | 120 Args: |
| 118 python_test_root: the path to walk, looking for pythonDrivenTests | 121 python_test_root: the path to walk, looking for pythonDrivenTests |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 Returns: | 208 Returns: |
| 206 List of test case objects for all available test methods. | 209 List of test case objects for all available test methods. |
| 207 """ | 210 """ |
| 208 if not test_root: | 211 if not test_root: |
| 209 return [] | 212 return [] |
| 210 all_tests = [] | 213 all_tests = [] |
| 211 test_module_list = _GetTestModules(test_root, is_official_build) | 214 test_module_list = _GetTestModules(test_root, is_official_build) |
| 212 for module in test_module_list: | 215 for module in test_module_list: |
| 213 all_tests.extend(_GetTestClassesFromModule(module)) | 216 all_tests.extend(_GetTestClassesFromModule(module)) |
| 214 return all_tests | 217 return all_tests |
| OLD | NEW |