diff options
author | jbudorick@chromium.org <jbudorick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-02-13 22:17:19 +0000 |
---|---|---|
committer | jbudorick@chromium.org <jbudorick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-02-13 22:17:19 +0000 |
commit | 0b64c91757eaf370138512864ad7f0f6f331b431 (patch) | |
tree | ffb93990db72b6fa8fb56558bbd5c6618424486b /build/android | |
parent | e130a701ac572a4a0ede0e473df7bbf542bdbd11 (diff) | |
download | chromium_src-0b64c91757eaf370138512864ad7f0f6f331b431.zip chromium_src-0b64c91757eaf370138512864ad7f0f6f331b431.tar.gz chromium_src-0b64c91757eaf370138512864ad7f0f6f331b431.tar.bz2 |
[Android] Lint pylib/instrumentation.
BUG=168518
NOTRY=true
Review URL: https://codereview.chromium.org/163923002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@251153 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'build/android')
-rw-r--r-- | build/android/pylib/host_driven/test_case.py | 2 | ||||
-rw-r--r-- | build/android/pylib/instrumentation/json_perf_parser.py | 3 | ||||
-rw-r--r-- | build/android/pylib/instrumentation/setup.py | 6 | ||||
-rw-r--r-- | build/android/pylib/instrumentation/test_jar.py | 9 | ||||
-rw-r--r-- | build/android/pylib/instrumentation/test_package.py | 3 | ||||
-rw-r--r-- | build/android/pylib/instrumentation/test_runner.py | 26 | ||||
-rw-r--r-- | build/android/pylib/uiautomator/setup.py | 6 |
7 files changed, 29 insertions, 26 deletions
diff --git a/build/android/pylib/host_driven/test_case.py b/build/android/pylib/host_driven/test_case.py index 3ee4fe7..5824a66 100644 --- a/build/android/pylib/host_driven/test_case.py +++ b/build/android/pylib/host_driven/test_case.py @@ -158,7 +158,7 @@ class HostDrivenTestCase(object): start_ms = int(time.time()) * 1000 done = False for test_filter in test_filters: - tests = test_pkg._GetAllMatchingTests(None, None, test_filter) + tests = test_pkg.GetAllMatchingTests(None, None, test_filter) # Filters should always result in >= 1 test. if len(tests) == 0: raise Exception('Java test filter "%s" returned no tests.' diff --git a/build/android/pylib/instrumentation/json_perf_parser.py b/build/android/pylib/instrumentation/json_perf_parser.py index e5e9d57..ffdfbe7 100644 --- a/build/android/pylib/instrumentation/json_perf_parser.py +++ b/build/android/pylib/instrumentation/json_perf_parser.py @@ -125,7 +125,8 @@ def GetAverageRunInfo(json_data, name): if entry['ph'] == 'I': result['type'] = 'Instant' last_val = val - if result['count'] > 0: result['average'] = total_sum / result['count'] + if result['count'] > 0: + result['average'] = total_sum / result['count'] return result diff --git a/build/android/pylib/instrumentation/setup.py b/build/android/pylib/instrumentation/setup.py index dff7a50..dd066fb 100644 --- a/build/android/pylib/instrumentation/setup.py +++ b/build/android/pylib/instrumentation/setup.py @@ -7,8 +7,8 @@ import logging import os -import test_package -import test_runner +from pylib.instrumentation import test_package +from pylib.instrumentation import test_runner def Setup(test_options): @@ -26,7 +26,7 @@ def Setup(test_options): test_pkg = test_package.TestPackage(test_options.test_apk_path, test_options.test_apk_jar_path) - tests = test_pkg._GetAllMatchingTests( + tests = test_pkg.GetAllMatchingTests( test_options.annotations, test_options.exclude_annotations, test_options.test_filter) diff --git a/build/android/pylib/instrumentation/test_jar.py b/build/android/pylib/instrumentation/test_jar.py index 21ce840..9df90fc 100644 --- a/build/android/pylib/instrumentation/test_jar.py +++ b/build/android/pylib/instrumentation/test_jar.py @@ -3,6 +3,7 @@ # found in the LICENSE file. """Helper class for instrumenation test jar.""" +# pylint: disable=W0702 import collections import logging @@ -127,7 +128,8 @@ class TestJar(object): def _GetAnnotationMap(self): return self._annotation_map - def _IsTestMethod(self, test): + @staticmethod + def _IsTestMethod(test): class_name, method = test.split('#') return class_name.endswith('Test') and method.startswith('test') @@ -137,7 +139,8 @@ class TestJar(object): return [] return self._GetAnnotationMap()[test] - def _AnnotationsMatchFilters(self, annotation_filter_list, annotations): + @staticmethod + def _AnnotationsMatchFilters(annotation_filter_list, annotations): """Checks if annotations match any of the filters.""" if not annotation_filter_list: return True @@ -173,7 +176,7 @@ class TestJar(object): tests_missing_annotations.append(test_method) return sorted(tests_missing_annotations) - def _GetAllMatchingTests(self, annotation_filter_list, + def GetAllMatchingTests(self, annotation_filter_list, exclude_annotation_list, test_filter): """Get a list of tests matching any of the annotations and the filter. diff --git a/build/android/pylib/instrumentation/test_package.py b/build/android/pylib/instrumentation/test_package.py index 34f9fe8..79b2fc9 100644 --- a/build/android/pylib/instrumentation/test_package.py +++ b/build/android/pylib/instrumentation/test_package.py @@ -6,10 +6,9 @@ import os +from pylib.instrumentation import test_jar from pylib.utils import apk_helper -import test_jar - class TestPackage(test_jar.TestJar): def __init__(self, apk_path, jar_path): diff --git a/build/android/pylib/instrumentation/test_runner.py b/build/android/pylib/instrumentation/test_runner.py index dda8162..6bb77e6 100644 --- a/build/android/pylib/instrumentation/test_runner.py +++ b/build/android/pylib/instrumentation/test_runner.py @@ -10,12 +10,6 @@ import re import sys import time - -sys.path.append(os.path.join(sys.path[0], - os.pardir, os.pardir, 'build', 'util', 'lib', - 'common')) -import perf_tests_results_helper - from pylib import android_commands from pylib import constants from pylib import flag_changer @@ -23,8 +17,12 @@ from pylib import valgrind_tools from pylib.base import base_test_result from pylib.base import base_test_runner from pylib.instrumentation import json_perf_parser +from pylib.instrumentation import test_result -import test_result +sys.path.append(os.path.join(sys.path[0], + os.pardir, os.pardir, 'build', 'util', 'lib', + 'common')) +import perf_tests_results_helper # pylint: disable=F0401 _PERF_TEST_ANNOTATION = 'PerfTest' @@ -73,9 +71,11 @@ class TestRunner(base_test_runner.BaseTestRunner): test_options.cleanup_test_files) self._lighttp_port = constants.LIGHTTPD_RANDOM_PORT_FIRST + shard_index + self.coverage_device_file = None + self.coverage_dir = test_options.coverage_dir + self.coverage_host_file = None self.options = test_options self.test_pkg = test_pkg - self.coverage_dir = test_options.coverage_dir # Use the correct command line file for the package under test. cmdline_file = [a.cmdline_file for a in constants.PACKAGE_INFO.itervalues() if a.test_package == self.test_pkg.GetPackageName()] @@ -112,7 +112,7 @@ class TestRunner(base_test_runner.BaseTestRunner): # TODO(frankf): Specify test data in this file as opposed to passing # as command-line. for dest_host_pair in self.options.test_data: - dst_src = dest_host_pair.split(':',1) + dst_src = dest_host_pair.split(':', 1) dst_layer = dst_src[0] host_src = dst_src[1] host_test_files_path = '%s/%s' % (constants.DIR_SOURCE_ROOT, host_src) @@ -152,7 +152,7 @@ class TestRunner(base_test_runner.BaseTestRunner): # We give different default value to launch HTTP server based on shard index # because it may have race condition when multiple processes are trying to # launch lighttpd with same port at same time. - http_server_ports = self.LaunchTestHttpServer( + self.LaunchTestHttpServer( os.path.join(constants.DIR_SOURCE_ROOT), self._lighttp_port) if self.flags: self.flags.AddFlags(['--disable-fre', '--enable-test-intents']) @@ -332,9 +332,9 @@ class TestRunner(base_test_runner.BaseTestRunner): raw_result = None start_date_ms = None results = base_test_result.TestRunResults() - timeout=(self._GetIndividualTestTimeoutSecs(test) * - self._GetIndividualTestTimeoutScale(test) * - self.tool.GetTimeoutScale()) + timeout = (self._GetIndividualTestTimeoutSecs(test) * + self._GetIndividualTestTimeoutScale(test) * + self.tool.GetTimeoutScale()) try: self.TestSetup(test) start_date_ms = int(time.time()) * 1000 diff --git a/build/android/pylib/uiautomator/setup.py b/build/android/pylib/uiautomator/setup.py index 3b56239..7a0e4af 100644 --- a/build/android/pylib/uiautomator/setup.py +++ b/build/android/pylib/uiautomator/setup.py @@ -21,9 +21,9 @@ def Setup(test_options): """ test_pkg = test_package.TestPackage(test_options.uiautomator_jar, test_options.uiautomator_info_jar) - tests = test_pkg._GetAllMatchingTests(test_options.annotations, - test_options.exclude_annotations, - test_options.test_filter) + tests = test_pkg.GetAllMatchingTests(test_options.annotations, + test_options.exclude_annotations, + test_options.test_filter) if not tests: logging.error('No uiautomator tests to run with current args.') |