Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(171)

Side by Side Diff: build/android/pylib/host_driven/run_python_tests.py

Issue 18514008: Relands test_runner.py, updates buildbot scripts (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Moves test_suite option back into gtest only Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
14 from pylib.base import base_test_result 13 from pylib.base import base_test_result
15 from pylib.instrumentation import test_package 14 from pylib.instrumentation import test_package
16 from pylib.instrumentation import test_runner 15 from pylib.instrumentation import test_runner
16 from pylib.utils import report_results
17 17
18 import python_test_base 18 import python_test_base
19 from python_test_caller import CallPythonTest
20 from python_test_sharder import PythonTestSharder 19 from python_test_sharder import PythonTestSharder
21 from test_info_collection import TestInfoCollection 20 from test_info_collection import TestInfoCollection
22 21
23 22
24 def _GetPythonFiles(root, files): 23 def _GetPythonFiles(root, files):
25 """Returns all files from |files| that end in 'Test.py'. 24 """Returns all files from |files| that end in 'Test.py'.
26 25
27 Args: 26 Args:
28 root: A directory name with python files. 27 root: A directory name with python files.
29 files: A list of file names. 28 files: A list of file names.
(...skipping 19 matching lines...) Expand all
49 48
50 49
51 def DispatchPythonTests(options): 50 def DispatchPythonTests(options):
52 """Dispatches the Python tests. If there are multiple devices, use sharding. 51 """Dispatches the Python tests. If there are multiple devices, use sharding.
53 52
54 Args: 53 Args:
55 options: command line options. 54 options: command line options.
56 55
57 Returns: 56 Returns:
58 A list of test results. 57 A list of test results.
58
59 Raises:
60 Exception: If there are no attached devices.
59 """ 61 """
60 62
61 attached_devices = android_commands.GetAttachedDevices() 63 attached_devices = android_commands.GetAttachedDevices()
62 if not attached_devices: 64 if not attached_devices:
63 raise Exception('You have no devices attached or visible!') 65 raise Exception('You have no devices attached or visible!')
64 if options.device: 66 if options.test_device:
65 attached_devices = [options.device] 67 attached_devices = [options.test_device]
66 68
67 test_collection = TestInfoCollection() 69 test_collection = TestInfoCollection()
68 all_tests = _GetAllTests(options.python_test_root, options.official_build) 70 all_tests = _GetAllTests(options.python_test_root, options.official_build)
69 test_collection.AddTests(all_tests) 71 test_collection.AddTests(all_tests)
70 test_names = [t.qualified_name for t in all_tests] 72 test_names = [t.qualified_name for t in all_tests]
71 logging.debug('All available tests: ' + str(test_names)) 73 logging.debug('All available tests: ' + str(test_names))
72 74
73 available_tests = test_collection.GetAvailableTests( 75 available_tests = test_collection.GetAvailableTests(
74 options.annotations, options.exclude_annotations, options.test_filter) 76 options.annotations, options.exclude_annotations, options.test_filter)
75 77
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 Returns: 205 Returns:
204 List of test case objects for all available test methods. 206 List of test case objects for all available test methods.
205 """ 207 """
206 if not test_root: 208 if not test_root:
207 return [] 209 return []
208 all_tests = [] 210 all_tests = []
209 test_module_list = _GetTestModules(test_root, is_official_build) 211 test_module_list = _GetTestModules(test_root, is_official_build)
210 for module in test_module_list: 212 for module in test_module_list:
211 all_tests.extend(_GetTestClassesFromModule(module)) 213 all_tests.extend(_GetTestClassesFromModule(module))
212 return all_tests 214 return all_tests
OLDNEW
« no previous file with comments | « build/android/pylib/gtest/test_package_executable.py ('k') | build/android/pylib/instrumentation/dispatch.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698