[Android] Lint pylib/base.
BUG=168518 Review URL: https://codereview.chromium.org/156603003 git-svn-id: http://src.chromium.org/svn/trunk/src/build@250545 4ff67af0-8c30-449e-8e8b-ad334ec8d88c
This commit is contained in:
Родитель
67c7ddf7a1
Коммит
9763b9f4f2
|
@ -6,9 +6,9 @@
|
||||||
|
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
from base_test_result import BaseTestResult
|
from pylib.base.base_test_result import BaseTestResult
|
||||||
from base_test_result import TestRunResults
|
from pylib.base.base_test_result import TestRunResults
|
||||||
from base_test_result import ResultType
|
from pylib.base.base_test_result import ResultType
|
||||||
|
|
||||||
|
|
||||||
class TestTestRunResults(unittest.TestCase):
|
class TestTestRunResults(unittest.TestCase):
|
||||||
|
|
|
@ -4,15 +4,10 @@
|
||||||
|
|
||||||
"""Base class for running tests on a single device."""
|
"""Base class for running tests on a single device."""
|
||||||
|
|
||||||
import contextlib
|
|
||||||
import httplib
|
|
||||||
import logging
|
import logging
|
||||||
import os
|
|
||||||
import tempfile
|
|
||||||
import time
|
import time
|
||||||
|
|
||||||
from pylib import android_commands
|
from pylib import android_commands
|
||||||
from pylib import constants
|
|
||||||
from pylib import ports
|
from pylib import ports
|
||||||
from pylib.chrome_test_server_spawner import SpawningServer
|
from pylib.chrome_test_server_spawner import SpawningServer
|
||||||
from pylib.forwarder import Forwarder
|
from pylib.forwarder import Forwarder
|
||||||
|
@ -181,7 +176,7 @@ class BaseTestRunner(object):
|
||||||
# well as IsHttpServerConnectable(). spawning_server.Start() should also
|
# well as IsHttpServerConnectable(). spawning_server.Start() should also
|
||||||
# block until the server is ready.
|
# block until the server is ready.
|
||||||
# Try 3 times to launch test spawner server.
|
# Try 3 times to launch test spawner server.
|
||||||
for i in xrange(0, 3):
|
for _ in xrange(0, 3):
|
||||||
self.test_server_spawner_port = ports.AllocateTestServerPort()
|
self.test_server_spawner_port = ports.AllocateTestServerPort()
|
||||||
self._ForwardPorts(
|
self._ForwardPorts(
|
||||||
[(self.test_server_spawner_port, self.test_server_spawner_port)])
|
[(self.test_server_spawner_port, self.test_server_spawner_port)])
|
||||||
|
|
|
@ -20,11 +20,10 @@ import threading
|
||||||
|
|
||||||
from pylib import android_commands
|
from pylib import android_commands
|
||||||
from pylib import constants
|
from pylib import constants
|
||||||
|
from pylib.base import base_test_result
|
||||||
from pylib.utils import reraiser_thread
|
from pylib.utils import reraiser_thread
|
||||||
from pylib.utils import watchdog_timer
|
from pylib.utils import watchdog_timer
|
||||||
|
|
||||||
import base_test_result
|
|
||||||
|
|
||||||
|
|
||||||
DEFAULT_TIMEOUT = 7 * 60 # seven minutes
|
DEFAULT_TIMEOUT = 7 * 60 # seven minutes
|
||||||
|
|
||||||
|
@ -69,7 +68,9 @@ class _TestCollection(object):
|
||||||
tests: List of tests to put in the collection.
|
tests: List of tests to put in the collection.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, tests=[]):
|
def __init__(self, tests=None):
|
||||||
|
if not tests:
|
||||||
|
tests = []
|
||||||
self._lock = threading.Lock()
|
self._lock = threading.Lock()
|
||||||
self._tests = []
|
self._tests = []
|
||||||
self._tests_in_progress = 0
|
self._tests_in_progress = 0
|
||||||
|
|
|
@ -3,6 +3,8 @@
|
||||||
# found in the LICENSE file.
|
# found in the LICENSE file.
|
||||||
|
|
||||||
"""Unittests for test_dispatcher.py."""
|
"""Unittests for test_dispatcher.py."""
|
||||||
|
# pylint: disable=R0201
|
||||||
|
# pylint: disable=W0212
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
@ -15,10 +17,10 @@ sys.path.append(os.path.join(os.path.dirname(os.path.realpath(__file__)),
|
||||||
from pylib import android_commands
|
from pylib import android_commands
|
||||||
android_commands.GetAttachedDevices = lambda: ['0', '1']
|
android_commands.GetAttachedDevices = lambda: ['0', '1']
|
||||||
from pylib import constants
|
from pylib import constants
|
||||||
|
from pylib.base import base_test_result
|
||||||
|
from pylib.base import test_dispatcher
|
||||||
from pylib.utils import watchdog_timer
|
from pylib.utils import watchdog_timer
|
||||||
|
|
||||||
import base_test_result
|
|
||||||
import test_dispatcher
|
|
||||||
|
|
||||||
|
|
||||||
class TestException(Exception):
|
class TestException(Exception):
|
||||||
|
@ -191,7 +193,7 @@ class TestShard(unittest.TestCase):
|
||||||
android_commands.GetAttachedDevices = lambda: []
|
android_commands.GetAttachedDevices = lambda: []
|
||||||
try:
|
try:
|
||||||
with self.assertRaises(AssertionError):
|
with self.assertRaises(AssertionError):
|
||||||
results, exit_code = TestShard._RunShard(MockRunner)
|
_results, _exit_code = TestShard._RunShard(MockRunner)
|
||||||
finally:
|
finally:
|
||||||
android_commands.GetAttachedDevices = attached_devices
|
android_commands.GetAttachedDevices = attached_devices
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче