diff options
author | jbudorick@chromium.org <jbudorick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-02-07 21:34:23 +0000 |
---|---|---|
committer | jbudorick@chromium.org <jbudorick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-02-07 21:34:23 +0000 |
commit | 7c3d872bdb4afe76f13e8d0bac3f0b08bc144045 (patch) | |
tree | 89fcfeb287949f5ab4aabbdf411c2d729fb1b4b0 /build/android/pylib/host_driven | |
parent | d851e2fe6bc837a135dfb36a0e8861b4d84d738f (diff) | |
download | chromium_src-7c3d872bdb4afe76f13e8d0bac3f0b08bc144045.zip chromium_src-7c3d872bdb4afe76f13e8d0bac3f0b08bc144045.tar.gz chromium_src-7c3d872bdb4afe76f13e8d0bac3f0b08bc144045.tar.bz2 |
Enable presubmit pylint in build/android.
BUG=168518
Review URL: https://codereview.chromium.org/132463007
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@249793 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'build/android/pylib/host_driven')
-rw-r--r-- | build/android/pylib/host_driven/setup.py | 6 | ||||
-rw-r--r-- | build/android/pylib/host_driven/test_case.py | 32 | ||||
-rw-r--r-- | build/android/pylib/host_driven/test_info_collection.py | 11 | ||||
-rw-r--r-- | build/android/pylib/host_driven/test_runner.py | 3 | ||||
-rw-r--r-- | build/android/pylib/host_driven/tests_annotations.py | 1 |
5 files changed, 29 insertions, 24 deletions
diff --git a/build/android/pylib/host_driven/setup.py b/build/android/pylib/host_driven/setup.py index a087bf1..d48f908 100644 --- a/build/android/pylib/host_driven/setup.py +++ b/build/android/pylib/host_driven/setup.py @@ -9,9 +9,9 @@ import os import sys import types -import test_case -import test_info_collection -import test_runner +from pylib.host_driven import test_case +from pylib.host_driven import test_info_collection +from pylib.host_driven import test_runner def _GetPythonFiles(root, files): diff --git a/build/android/pylib/host_driven/test_case.py b/build/android/pylib/host_driven/test_case.py index 8ff9408..e914b67 100644 --- a/build/android/pylib/host_driven/test_case.py +++ b/build/android/pylib/host_driven/test_case.py @@ -25,7 +25,6 @@ import os import time from pylib import android_commands -from pylib import constants from pylib import forwarder from pylib import valgrind_tools from pylib.base import base_test_result @@ -49,21 +48,28 @@ class HostDrivenTestCase(object): test_name: The name of the method to run as the test. instrumentation_options: An InstrumentationOptions object. """ - self.test_name = test_name class_name = self.__class__.__name__ - self.qualified_name = '%s.%s' % (class_name, self.test_name) + self.adb = None + self.cleanup_test_files = False + self.device_id = '' + self.has_forwarded_ports = False + self.instrumentation_options = instrumentation_options + self.ports_to_forward = [] + self.push_deps = False + self.shard_index = 0 + # Use tagged_name when creating results, so that we can identify host-driven # tests in the overall results. + self.test_name = test_name + self.qualified_name = '%s.%s' % (class_name, self.test_name) self.tagged_name = '%s_%s' % (self._HOST_DRIVEN_TAG, self.qualified_name) - self.instrumentation_options = instrumentation_options - self.ports_to_forward = [] - self.has_forwarded_ports = False - # TODO(bulach): make ports_to_forward not optional and move the Forwarder # mapping here. def SetUp(self, device, shard_index, push_deps, - cleanup_test_files, ports_to_forward=[]): + cleanup_test_files, ports_to_forward=None): + if not ports_to_forward: + ports_to_forward = [] self.device_id = device self.shard_index = shard_index self.adb = android_commands.AndroidCommands(self.device_id) @@ -75,17 +81,13 @@ class HostDrivenTestCase(object): def TearDown(self): pass - # TODO(craigdh): Remove GetOutDir once references have been removed - # downstream. - def GetOutDir(self): - return constants.GetOutDirectory() - def Run(self): logging.info('Running host-driven test: %s', self.tagged_name) # Get the test method on the derived class and execute it return getattr(self, self.test_name)() - def __GetHostForwarderLog(self): + @staticmethod + def __GetHostForwarderLog(): return ('-- Begin Full HostForwarder log\n' '%s\n' '--End Full HostForwarder log\n' % forwarder.Forwarder.GetHostLog()) @@ -151,7 +153,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/host_driven/test_info_collection.py b/build/android/pylib/host_driven/test_info_collection.py index a857d3c..b0b76a9 100644 --- a/build/android/pylib/host_driven/test_info_collection.py +++ b/build/android/pylib/host_driven/test_info_collection.py @@ -7,7 +7,7 @@ import logging import os -import tests_annotations +from pylib.host_driven import tests_annotations class TestInfo(object): @@ -22,7 +22,8 @@ class TestInfo(object): self.set_up = set_up self.tear_down = tear_down - def _GetQualifiedName(self, runnable): + @staticmethod + def _GetQualifiedName(runnable): """Helper method to infer a runnable's name and module name. Many filters and lists presuppose a format of module_name.testMethodName. @@ -102,7 +103,8 @@ class TestInfoCollection(object): return available_tests - def _AnnotationIncludesTest(self, test_info, annotation_filter_list): + @staticmethod + def _AnnotationIncludesTest(test_info, annotation_filter_list): """Checks whether a given test represented by test_info matches annotation. Args: @@ -128,7 +130,8 @@ class TestInfoCollection(object): return True return False - def _NameFilterIncludesTest(self, test_info, name_filter): + @staticmethod + def _NameFilterIncludesTest(test_info, name_filter): """Checks whether a name filter matches a given test_info's method name. This is a case-sensitive, substring comparison: 'Foo' will match methods diff --git a/build/android/pylib/host_driven/test_runner.py b/build/android/pylib/host_driven/test_runner.py index 53fd70f..c7d6ed1 100644 --- a/build/android/pylib/host_driven/test_runner.py +++ b/build/android/pylib/host_driven/test_runner.py @@ -11,10 +11,9 @@ import traceback from pylib.base import base_test_result from pylib.base import base_test_runner +from pylib.host_driven import test_case from pylib.instrumentation import test_result -import test_case - class HostDrivenExceptionTestResult(test_result.InstrumentationTestResult): """Test result corresponding to a python exception in a host-driven test.""" diff --git a/build/android/pylib/host_driven/tests_annotations.py b/build/android/pylib/host_driven/tests_annotations.py index d5f557d..5331140 100644 --- a/build/android/pylib/host_driven/tests_annotations.py +++ b/build/android/pylib/host_driven/tests_annotations.py @@ -3,6 +3,7 @@ # found in the LICENSE file. """Annotations for host-driven tests.""" +# pylint: disable=W0212 import os |