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

Side by Side Diff: build/android/pylib/gtest/setup.py

Issue 1315743004: [Android] Add a custom pylintrc for build/android/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 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 2013 The Chromium Authors. All rights reserved. 1 # Copyright 2013 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 """Generates test runner factory and tests for GTests.""" 5 """Generates test runner factory and tests for GTests."""
6 # pylint: disable=W0212 6 # pylint: disable=W0212
7 7
8 import logging 8 import logging
9 import os 9 import os
10 import sys 10 import sys
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 87
88 Returns: 88 Returns:
89 A list of all the tests in the test suite. 89 A list of all the tests in the test suite.
90 """ 90 """
91 class TestListResult(base_test_result.BaseTestResult): 91 class TestListResult(base_test_result.BaseTestResult):
92 def __init__(self): 92 def __init__(self):
93 super(TestListResult, self).__init__( 93 super(TestListResult, self).__init__(
94 'gtest_list_tests', base_test_result.ResultType.PASS) 94 'gtest_list_tests', base_test_result.ResultType.PASS)
95 self.test_list = [] 95 self.test_list = []
96 96
97 # pylint: disable=unused-argument
97 def TestListerRunnerFactory(device, _shard_index): 98 def TestListerRunnerFactory(device, _shard_index):
98 class TestListerRunner(test_runner.TestRunner): 99 class TestListerRunner(test_runner.TestRunner):
99 def RunTest(self, _test): 100 def RunTest(self, _test):
100 result = TestListResult() 101 result = TestListResult()
101 self.test_package.Install(self.device) 102 self.test_package.Install(self.device)
102 result.test_list = self.test_package.GetAllTests(self.device) 103 result.test_list = self.test_package.GetAllTests(self.device)
103 results = base_test_result.TestRunResults() 104 results = base_test_result.TestRunResults()
104 results.AddResult(result) 105 results.AddResult(result)
105 return results, None 106 return results, None
106 return TestListerRunner(test_options, device, test_package) 107 return TestListerRunner(test_options, device, test_package)
107 108
108 results, _no_retry = test_dispatcher.RunTests( 109 results, _ = test_dispatcher.RunTests(
109 ['gtest_list_tests'], TestListerRunnerFactory, devices) 110 ['gtest_list_tests'], TestListerRunnerFactory, devices)
110 tests = [] 111 tests = []
111 for r in results.GetAll(): 112 for r in results.GetAll():
112 tests.extend(r.test_list) 113 tests.extend(r.test_list)
113 return tests 114 return tests
114 115
115 116
116 def _FilterTestsUsingPrefixes(all_tests, pre=False, manual=False): 117 def _FilterTestsUsingPrefixes(all_tests, pre=False, manual=False):
117 """Removes tests with disabled prefixes. 118 """Removes tests with disabled prefixes.
118 119
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 if test_package.suite_name == 'breakpad_unittests' 198 if test_package.suite_name == 'breakpad_unittests'
198 else device.GetExternalStoragePath()) 199 else device.GetExternalStoragePath())
199 base_setup.PushDataDeps(device, device_dir, test_options) 200 base_setup.PushDataDeps(device, device_dir, test_options)
200 device_utils.DeviceUtils.parallel(devices).pMap(push_data_deps_to_device_dir) 201 device_utils.DeviceUtils.parallel(devices).pMap(push_data_deps_to_device_dir)
201 if i: 202 if i:
202 i.Clear() 203 i.Clear()
203 204
204 tests = _GetTests(test_options, test_package, devices) 205 tests = _GetTests(test_options, test_package, devices)
205 206
206 # Constructs a new TestRunner with the current options. 207 # Constructs a new TestRunner with the current options.
208 # pylint: disable=unused-argument
207 def TestRunnerFactory(device, _shard_index): 209 def TestRunnerFactory(device, _shard_index):
208 return test_runner.TestRunner( 210 return test_runner.TestRunner(
209 test_options, 211 test_options,
210 device, 212 device,
211 test_package) 213 test_package)
212 214
213 if test_options.run_disabled: 215 if test_options.run_disabled:
214 test_options = test_options._replace( 216 test_options = test_options._replace(
215 test_arguments=('%s --gtest_also_run_disabled_tests' % 217 test_arguments=('%s --gtest_also_run_disabled_tests' %
216 test_options.test_arguments)) 218 test_options.test_arguments))
217 else: 219 else:
218 tests = _FilterDisabledTests(tests, test_options.suite_name, 220 tests = _FilterDisabledTests(tests, test_options.suite_name,
219 bool(test_options.gtest_filter)) 221 bool(test_options.gtest_filter))
220 if test_options.gtest_filter: 222 if test_options.gtest_filter:
221 tests = unittest_util.FilterTestNames(tests, test_options.gtest_filter) 223 tests = unittest_util.FilterTestNames(tests, test_options.gtest_filter)
222 224
223 # Coalesce unit tests into a single test per device 225 # Coalesce unit tests into a single test per device
224 if test_options.suite_name not in gtest_test_instance.BROWSER_TEST_SUITES: 226 if test_options.suite_name not in gtest_test_instance.BROWSER_TEST_SUITES:
225 num_devices = len(devices) 227 num_devices = len(devices)
226 tests = [':'.join(tests[i::num_devices]) for i in xrange(num_devices)] 228 tests = [':'.join(tests[i::num_devices]) for i in xrange(num_devices)]
227 tests = [t for t in tests if t] 229 tests = [t for t in tests if t]
228 230
229 return (TestRunnerFactory, tests) 231 return (TestRunnerFactory, tests)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698