[Android] Lint pylib/host_driven.

BUG=168518

Review URL: https://codereview.chromium.org/159853010

git-svn-id: http://src.chromium.org/svn/trunk/src/build@250822 4ff67af0-8c30-449e-8e8b-ad334ec8d88c
This commit is contained in:
jbudorick@chromium.org 2014-02-12 23:05:36 +00:00
Родитель 4418261943
Коммит 0460369301
5 изменённых файлов: 29 добавлений и 19 удалений

Просмотреть файл

@ -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):

Просмотреть файл

@ -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)
# Use tagged_name when creating results, so that we can identify host-driven
# tests in the overall results.
self.tagged_name = '%s_%s' % (self._HOST_DRIVEN_TAG, self.qualified_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.has_forwarded_ports = False
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)
# 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)
@ -85,7 +91,8 @@ class HostDrivenTestCase(object):
# 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())

Просмотреть файл

@ -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

Просмотреть файл

@ -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."""

Просмотреть файл

@ -3,6 +3,7 @@
# found in the LICENSE file.
"""Annotations for host-driven tests."""
# pylint: disable=W0212
import os