Atest: fix line-too-long and relative-import error.
Also, shrink the length of atest_arg_parser.py to make lines shorter
than 80 chars.
Bug: 145644899
Test: None
Change-Id: I1c868e34b5abc96abf9f1fd09de0ceb9071e6b78
diff --git a/atest/atest.py b/atest/atest.py
index 3da31fe..d1851ca 100755
--- a/atest/atest.py
+++ b/atest/atest.py
@@ -23,6 +23,9 @@
atest is designed to support any test types that can be ran by TradeFederation.
"""
+# pylint: disable=relative-import
+# pylint: disable=line-too-long
+
from __future__ import print_function
import logging
@@ -40,7 +43,6 @@
import atest_utils
import bug_detector
import cli_translator
-# pylint: disable=import-error
import constants
import module_info
import result_reporter
@@ -127,9 +129,11 @@
log_format = '%(asctime)s %(filename)s:%(lineno)s:%(levelname)s: %(message)s'
datefmt = '%Y-%m-%d %H:%M:%S'
if verbose:
- logging.basicConfig(level=logging.DEBUG, format=log_format, datefmt=datefmt)
+ logging.basicConfig(level=logging.DEBUG,
+ format=log_format, datefmt=datefmt)
else:
- logging.basicConfig(level=logging.INFO, format=log_format, datefmt=datefmt)
+ logging.basicConfig(level=logging.INFO,
+ format=log_format, datefmt=datefmt)
def _missing_environment_variables():
@@ -155,7 +159,8 @@
if not os.path.exists(constants.ATEST_RESULT_ROOT):
os.makedirs(constants.ATEST_RESULT_ROOT)
ctime = time.strftime(TEST_RUN_DIR_PREFIX, time.localtime())
- return tempfile.mkdtemp(prefix='%s_' % ctime, dir=constants.ATEST_RESULT_ROOT)
+ return tempfile.mkdtemp(prefix='%s_' % ctime,
+ dir=constants.ATEST_RESULT_ROOT)
def get_extra_args(args):
@@ -279,7 +284,8 @@
def _will_run_tests(args):
"""Determine if there are tests to run.
- Currently only used by detect_regression to skip the test if just running regression detection.
+ Currently only used by detect_regression to skip the test if just running
+ regression detection.
Args:
args: parsed args object.
@@ -300,21 +306,24 @@
True if args are valid
"""
if args.generate_baseline and args.generate_new_metrics:
- logging.error('Cannot collect both baseline and new metrics at the same time.')
+ logging.error('Cannot collect both baseline and new metrics'
+ 'at the same time.')
return False
if args.detect_regression is not None:
if not args.detect_regression:
- logging.error('Need to specify at least 1 arg for regression detection.')
+ logging.error('Need to specify at least 1 arg for'
+ ' regression detection.')
return False
elif len(args.detect_regression) == 1:
if args.generate_baseline or args.generate_new_metrics:
return True
- logging.error('Need to specify --generate-baseline or --generate-new-metrics.')
+ logging.error('Need to specify --generate-baseline or'
+ ' --generate-new-metrics.')
return False
elif len(args.detect_regression) == 2:
if args.generate_baseline:
- logging.error('Specified 2 metric paths and --generate-baseline, '
- 'either drop --generate-baseline or drop a path')
+ logging.error('Specified 2 metric paths and --generate-baseline'
+ ', either drop --generate-baseline or drop a path')
return False
if args.generate_new_metrics:
logging.error('Specified 2 metric paths and --generate-new-metrics, '
diff --git a/atest/atest_arg_parser.py b/atest/atest_arg_parser.py
index d8c5543..f697001 100644
--- a/atest/atest_arg_parser.py
+++ b/atest/atest_arg_parser.py
@@ -16,6 +16,8 @@
Atest Argument Parser class for atest.
"""
+# pylint: disable=relative-import
+
import argparse
import atest_utils
@@ -56,101 +58,125 @@
def add_atest_args(self):
"""A function that does ArgumentParser.add_argument()"""
self.add_argument('tests', nargs='*', help='Tests to build and/or run.')
+ # Options that to do with testing.
+ self.add_argument('-a', '--all-abi', action='store_true',
+ help='Set to run tests for all abis.')
self.add_argument('-b', '--build', action='append_const', dest='steps',
const=constants.BUILD_STEP, help='Run a build.')
- self.add_argument('-i', '--install', action='append_const', dest='steps',
- const=constants.INSTALL_STEP, help='Install an APK.')
- self.add_argument('--info', action='store_true',
- help='Show module information.')
- self.add_argument('--dry-run', action='store_true',
- help='Dry run atest without building, installing and running '
- 'tests in real.')
- self.add_argument('-t', '--test', action='append_const', dest='steps',
- const=constants.TEST_STEP,
- help='Run the tests. WARNING: Many test configs force cleanup '
- 'of device after test run. In this case, -d must be used in '
- 'previous test run to disable cleanup, for -t to work. '
- 'Otherwise, device will need to be setup again with -i.')
- self.add_argument('-s', '--serial', help='The device to run the test on.')
- self.add_argument('-L', '--list-modules', help='List testable modules for the given suite.')
self.add_argument('-d', '--disable-teardown', action='store_true',
help='Disables test teardown and cleanup.')
- self.add_argument('-m', constants.REBUILD_MODULE_INFO_FLAG, action='store_true',
+ self.add_argument('--host', action='store_true',
+ help='Run the test completely on the host without '
+ 'a device. (Note: running a host test that '
+ 'requires a device without --host will fail.)')
+ self.add_argument('-i', '--install', action='append_const',
+ dest='steps', const=constants.INSTALL_STEP,
+ help='Install an APK.')
+ self.add_argument('-m', constants.REBUILD_MODULE_INFO_FLAG,
+ action='store_true',
help='Forces a rebuild of the module-info.json file. '
'This may be necessary following a repo sync or '
'when writing a new test.')
+ self.add_argument('-s', '--serial',
+ help='The device to run the test on.')
+ self.add_argument('-t', '--test', action='append_const', dest='steps',
+ const=constants.TEST_STEP,
+ help='Run the tests. WARNING: Many test configs force'
+ ' cleanup of device after test run. In this case'
+ ', -d must be used in previous test run to '
+ 'disable cleanup, for -t to work. Otherwise, '
+ 'device will need to be setup again with -i.')
self.add_argument('-w', '--wait-for-debugger', action='store_true',
help='Only for instrumentation tests. Waits for '
'debugger prior to execution.')
+
+ # Options related to Test Mapping
+ self.add_argument('-p', '--test-mapping', action='store_true',
+ help='Run tests defined in TEST_MAPPING files.')
+ self.add_argument('--include-subdirs', action='store_true',
+ help='Include tests in TEST_MAPPING files in sub'
+ ' directories.')
+
+ # Options for information queries and dry-runs:
+ self.add_argument('--dry-run', action='store_true',
+ help='Dry run atest without building, installing and'
+ ' running tests in real.')
+ self.add_argument('-h', '--help', action='store_true',
+ help='Print this help message.')
+ self.add_argument('--info', action='store_true',
+ help='Show module information.')
+ self.add_argument('-L', '--list-modules',
+ help='List testable modules for the given suite.')
self.add_argument('-v', '--verbose', action='store_true',
help='Display DEBUG level logging.')
self.add_argument('-V', '--version', action='store_true',
help='Display version string.')
- self.add_argument('-a', '--all-abi', action='store_true',
- help='Set to run tests for all abi.')
- self.add_argument('--generate-baseline', nargs='?', type=int, const=5, default=0,
- help='Generate baseline metrics, run 5 iterations by default. '
- 'Provide an int argument to specify # iterations.')
- self.add_argument('--generate-new-metrics', nargs='?', type=int, const=5, default=0,
- help='Generate new metrics, run 5 iterations by default. '
- 'Provide an int argument to specify # iterations.')
+
+ # Obsolete options that will be removed soon.
+ self.add_argument('--generate-baseline', nargs='?',
+ type=int, const=5, default=0,
+ help='Generate baseline metrics, run 5 iterations by'
+ 'default. Provide an int argument to specify '
+ '# iterations.')
+ self.add_argument('--generate-new-metrics', nargs='?',
+ type=int, const=5, default=0,
+ help='Generate new metrics, run 5 iterations by '
+ 'default. Provide an int argument to specify '
+ '# iterations.')
self.add_argument('--detect-regression', nargs='*',
help='Run regression detection algorithm. Supply '
'path to baseline and/or new metrics folders.')
+
# Options related to module parameterization
self.add_argument('--instant', action='store_true',
help='Run the instant_app version of the module, '
- 'if the module supports it. Note: running a test '
- 'that does not support instant with --instant '
+ 'if the module supports it. Note: running a test'
+ ' that does not support instant with --instant '
'will result in nothing running.')
- self.add_argument('--user-type', help='Run test with specific user type.'
- 'E.g. --user-type secondary_user')
- # Options related to Test Mapping
- self.add_argument('-p', '--test-mapping', action='store_true',
- help='Run tests in TEST_MAPPING files.')
- self.add_argument('--include-subdirs', action='store_true',
- help='Include tests in TEST_MAPPING files in sub directories.')
- # Options related to deviceless testing.
- self.add_argument('--host', action='store_true',
- help='Run the test completely on the host without '
- 'a device. (Note: running a host test that '
- 'requires a device with --host will fail.)')
- # Option for updating dry-run command mapping result.
+ self.add_argument('--user-type',
+ help='Run test with specific user type.'
+ 'E.g. --user-type secondary_user')
+
+ # Option for dry-run command mapping result and cleaning cache.
+ self.add_argument('-c', '--clear-cache', action='store_true',
+ help='Wipe out the test_infos cache of the test.')
self.add_argument('-u', '--update-cmd-mapping', action='store_true',
help='Update the test command of input tests. '
'Warning: result will be saved under '
'tools/tradefederation/core/atest/test_data.')
- # Option for verifying dry-run command mapping result.
self.add_argument('-y', '--verify-cmd-mapping', action='store_true',
help='Verify the test command of input tests.')
- # Option for clearing cache of input test reference .
- self.add_argument('-c', '--clear-cache', action='store_true',
- help='Wipe out the test_infos cache of the test.')
- # A group of options for rerun strategy. They are mutually exclusive in a command line.
+
+ # A group of options for rerun strategy. They are mutually exclusive
+ # in a command line.
group = self.add_mutually_exclusive_group()
# Option for rerun tests for the specified number iterations.
group.add_argument('--iterations', nargs='?',
type=_positive_int, const=10, default=0,
metavar='MAX_ITERATIONS',
- help='Rerun all tests, run 10 iterations by default. '
- 'Accept a positive int for # iterations.')
+ help='Rerun all tests, run 10 iterations by default.'
+ ' Accept a positive int for # iterations.')
group.add_argument('--rerun-until-failure', nargs='?',
type=_positive_int, const=10, default=0,
metavar='MAX_ITERATIONS',
- help='Rerun all tests until a failure occurs or max iterations is '
- 'reached, run 10 iterations by default. '
+ help='Rerun all tests until a failure occurs or the '
+ 'max iteration is reached, run 10 iterations by'
+ 'default. '
'Accept a positive int for # iterations.')
group.add_argument('--retry-any-failure', nargs='?',
type=_positive_int, const=10, default=0,
metavar='MAX_ITERATIONS',
- help='Rerun failed tests until passed or max iterations is reached, '
- 'run 10 iterations by default. '
+ help='Rerun failed tests until passed or the max '
+ 'iteration is reached, run 10 iterations by '
+ 'default. '
'Accept a positive int for # iterations.')
- # This arg actually doesn't consume anything, it's primarily used for the
- # help description and creating custom_args in the NameSpace object.
+
+ # This arg actually doesn't consume anything, it's primarily used for
+ # the help description and creating custom_args in the NameSpace object.
self.add_argument('--', dest='custom_args', nargs='*',
help='Specify custom args for the test runners. '
- 'Everything after -- will be consumed as custom args.')
+ 'Everything after -- will be consumed as '
+ 'custom args.')
def get_args(self):
"""This method is to get args from actions and return optional args.
diff --git a/atest/atest_arg_parser_unittest.py b/atest/atest_arg_parser_unittest.py
index a4fce6f..13aa29c 100755
--- a/atest/atest_arg_parser_unittest.py
+++ b/atest/atest_arg_parser_unittest.py
@@ -16,6 +16,8 @@
"""Unittests for atest_arg_parser."""
+# pylint: disable=relative-import
+
import unittest
import atest_arg_parser
diff --git a/atest/atest_execution_info.py b/atest/atest_execution_info.py
index 1ef8634..43e67b3 100644
--- a/atest/atest_execution_info.py
+++ b/atest/atest_execution_info.py
@@ -11,9 +11,11 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-"""
-ATest execution info generator.
-"""
+
+"""ATest execution info generator."""
+
+# pylint: disable=line-too-long
+# pylint: disable=relative-import
from __future__ import print_function
@@ -182,7 +184,8 @@
info_dict[_TEST_RUNNER_KEY] = {}
for reporter in reporters:
for test in reporter.all_test_results:
- runner = info_dict[_TEST_RUNNER_KEY].setdefault(test.runner_name, {})
+ runner = info_dict[_TEST_RUNNER_KEY].setdefault(
+ test.runner_name, {})
group = runner.setdefault(test.group_name, {})
result_dict = {_TEST_NAME_KEY : test.test_name,
_TEST_TIME_KEY : test.test_time,
diff --git a/atest/atest_execution_info_unittest.py b/atest/atest_execution_info_unittest.py
index 8024df9..e54ac5c 100755
--- a/atest/atest_execution_info_unittest.py
+++ b/atest/atest_execution_info_unittest.py
@@ -16,6 +16,9 @@
"""Unittest for atest_execution_info."""
+# pylint: disable=relative-import
+# pylint: disable=line-too-long
+
import time
import unittest
diff --git a/atest/atest_integration_tests.py b/atest/atest_integration_tests.py
index 5779429..3b36522 100755
--- a/atest/atest_integration_tests.py
+++ b/atest/atest_integration_tests.py
@@ -142,7 +142,8 @@
test_func_name, test_func = create_test_method(
test.strip(), LOG_PATH)
setattr(ATestIntegrationTest, test_func_name, test_func)
- SUITE = unittest.TestLoader().loadTestsFromTestCase(ATestIntegrationTest)
+ SUITE = unittest.TestLoader().loadTestsFromTestCase(
+ ATestIntegrationTest)
RESULTS = unittest.TextTestRunner(verbosity=2).run(SUITE)
finally:
if RESULTS.failures:
diff --git a/atest/atest_metrics.py b/atest/atest_metrics.py
index 5ab0a92..9465a14 100755
--- a/atest/atest_metrics.py
+++ b/atest/atest_metrics.py
@@ -16,6 +16,8 @@
"""Simple Metrics Functions"""
+# pylint: disable=relative-import
+
import constants
import asuite_metrics
diff --git a/atest/atest_run_unittests.py b/atest/atest_run_unittests.py
index 440d7b3..5020471 100755
--- a/atest/atest_run_unittests.py
+++ b/atest/atest_run_unittests.py
@@ -13,8 +13,12 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
+
"""Main entrypoint for all of atest's unittest."""
+# pylint: disable=relative-import
+# pylint: disable=line-too-long
+
import logging
import os
import sys
diff --git a/atest/atest_unittest.py b/atest/atest_unittest.py
index f2b2809..f4825b0 100755
--- a/atest/atest_unittest.py
+++ b/atest/atest_unittest.py
@@ -16,6 +16,9 @@
"""Unittests for atest."""
+# pylint: disable=relative-import
+# pylint: disable=line-too-long
+
import datetime
import os
import sys
diff --git a/atest/atest_utils.py b/atest/atest_utils.py
index f784b86..c7bd9d8 100644
--- a/atest/atest_utils.py
+++ b/atest/atest_utils.py
@@ -16,6 +16,8 @@
Utility functions for atest.
"""
+# pylint: disable=relative-import
+
from __future__ import print_function
import hashlib
@@ -380,9 +382,9 @@
former_test_cmds = full_result_content.get(input_test, [])
if not _are_identical_cmds(test_cmds, former_test_cmds):
if do_verification:
- raise atest_error.DryRunVerificationError('Dry run verification failed,'
- ' former commands: %s' %
- former_test_cmds)
+ raise atest_error.DryRunVerificationError(
+ 'Dry run verification failed, former commands: {}'.format(
+ former_test_cmds))
if former_test_cmds:
# If former_test_cmds is different from test_cmds, ask users if they
# are willing to update the result.
@@ -399,9 +401,9 @@
print('SKIP updating result!!!')
return
except ValueError:
- # Default action is updating the command result of the input_test.
- # If the user input is unrecognizable telling yes or no,
- # "Y" is implicitly applied.
+ # Default action is updating the command result of the
+ # input_test. If the user input is unrecognizable telling yes
+ # or no, "Y" is implicitly applied.
pass
else:
# If current commands are the same as the formers, no need to update
@@ -524,8 +526,8 @@
with open(cache_file, 'rb') as config_dictionary_file:
return pickle.load(config_dictionary_file)
except (pickle.UnpicklingError, ValueError, EOFError, IOError) as err:
- # Won't break anything, just remove the old cache, log this error, and
- # collect the exception by metrics.
+ # Won't break anything, just remove the old cache, log this error,
+ # and collect the exception by metrics.
logging.debug('Exception raised: %s', err)
os.remove(cache_file)
metrics_utils.handle_exc_and_send_exit_event(
diff --git a/atest/atest_utils_unittest.py b/atest/atest_utils_unittest.py
index 6b7a0b6..89a59c7 100755
--- a/atest/atest_utils_unittest.py
+++ b/atest/atest_utils_unittest.py
@@ -16,6 +16,9 @@
"""Unittests for atest_utils."""
+# pylint: disable=relative-import
+# pylint: disable=line-too-long
+
import hashlib
import os
import subprocess
diff --git a/atest/bug_detector.py b/atest/bug_detector.py
index 25438d2..6082f14 100644
--- a/atest/bug_detector.py
+++ b/atest/bug_detector.py
@@ -12,9 +12,10 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-"""
-Classes for bug events history
-"""
+"""Classes for bug events history."""
+
+# pylint: disable=line-too-long
+# pylint: disable=relative-import
import datetime
import logging
diff --git a/atest/bug_detector_unittest.py b/atest/bug_detector_unittest.py
index d7ced5f..e14d821 100755
--- a/atest/bug_detector_unittest.py
+++ b/atest/bug_detector_unittest.py
@@ -16,6 +16,9 @@
"""Unittests for bug_detector."""
+# pylint: disable=relative-import
+# pylint: disable=line-too-long
+
import datetime
import json
import os
diff --git a/atest/cli_translator.py b/atest/cli_translator.py
index 97d7616..6c49ea4 100644
--- a/atest/cli_translator.py
+++ b/atest/cli_translator.py
@@ -12,10 +12,11 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-#pylint: disable=too-many-lines
-"""
-Command Line Translator for atest.
-"""
+"""Command Line Translator for atest."""
+
+# pylint: disable=line-too-long
+# pylint: disable=too-many-lines
+# pylint: disable=relative-import
from __future__ import print_function
@@ -235,7 +236,8 @@
Valid json string without comments.
"""
def _replace(match):
- """Replace comments if found matching the defined regular expression.
+ """Replace comments if found matching the defined regular
+ expression.
Args:
match: The matched regex pattern
diff --git a/atest/cli_translator_unittest.py b/atest/cli_translator_unittest.py
index 11f6e8d..132f529 100755
--- a/atest/cli_translator_unittest.py
+++ b/atest/cli_translator_unittest.py
@@ -16,6 +16,9 @@
"""Unittests for cli_translator."""
+# pylint: disable=relative-import
+# pylint: disable=line-too-long
+
import unittest
import json
import os
diff --git a/atest/constants.py b/atest/constants.py
index fad8ef5..1f1b9df 100644
--- a/atest/constants.py
+++ b/atest/constants.py
@@ -15,8 +15,9 @@
"""
Imports the various constant files that are available (default, google, etc).
"""
-#pylint: disable=wildcard-import
-#pylint: disable=unused-wildcard-import
+# pylint: disable=wildcard-import
+# pylint: disable=unused-wildcard-import
+# pylint: disable=relative-import
from constants_default import *
diff --git a/atest/constants_default.py b/atest/constants_default.py
index 78c043a..5b2f511 100644
--- a/atest/constants_default.py
+++ b/atest/constants_default.py
@@ -16,6 +16,8 @@
Various globals used by atest.
"""
+# pylint: disable=line-too-long
+
import os
import re
diff --git a/atest/metrics/clearcut_client.py b/atest/metrics/clearcut_client.py
index ecb83c3..efd4caa 100644
--- a/atest/metrics/clearcut_client.py
+++ b/atest/metrics/clearcut_client.py
@@ -76,9 +76,9 @@
def log(self, event):
"""Logs events to Clearcut.
- Logging an event can potentially trigger a flush of queued events. Flushing
- is triggered when the buffer is more than half full or after the flush
- interval has passed.
+ Logging an event can potentially trigger a flush of queued events.
+ Flushing is triggered when the buffer is more than half full or
+ after the flush interval has passed.
Args:
event: A LogEvent to send to Clearcut.
@@ -127,7 +127,8 @@
if min_wait_sec > time_from_now:
time_from_now = min_wait_sec
logging.debug('Scheduling thread to run in %f seconds', time_from_now)
- self._scheduled_flush_thread = threading.Timer(time_from_now, self._flush)
+ self._scheduled_flush_thread = threading.Timer(
+ time_from_now, self._flush)
self._scheduled_flush_time = time.time() + time_from_now
self._scheduled_flush_thread.start()
diff --git a/atest/metrics/metrics_base.py b/atest/metrics/metrics_base.py
index 73027b4..6f69a86 100644
--- a/atest/metrics/metrics_base.py
+++ b/atest/metrics/metrics_base.py
@@ -60,8 +60,8 @@
INTERNAL_USER if user is internal, EXTERNAL_USER otherwise.
"""
try:
- output = subprocess.check_output(['git', 'config', '--get', 'user.email'],
- universal_newlines=True)
+ output = subprocess.check_output(
+ ['git', 'config', '--get', 'user.email'], universal_newlines=True)
if output and output.strip().endswith(constants.INTERNAL_EMAIL):
return INTERNAL_USER
except OSError:
@@ -124,7 +124,8 @@
'user_type': cls._user_type,
'tool_name': cls.tool_name,
cls._EVENT_NAME: fields_and_values}
- log_event = cls._build_full_event(ATEST_EVENTS[cls._user_type](**params))
+ log_event = cls._build_full_event(
+ ATEST_EVENTS[cls._user_type](**params))
cls.cc.log(log_event)
return cls.cc
@@ -140,6 +141,7 @@
A clientanalytics_pb2.LogEvent instance.
"""
log_event = clientanalytics_pb2.LogEvent()
- log_event.event_time_ms = int((time.time() - random.randint(1, 600)) * 1000)
+ log_event.event_time_ms = int(
+ (time.time() - random.randint(1, 600)) * 1000)
log_event.source_extension = atest_event.SerializeToString()
return log_event
diff --git a/atest/module_info.py b/atest/module_info.py
index ec9a7a9..5a9c39f 100644
--- a/atest/module_info.py
+++ b/atest/module_info.py
@@ -16,6 +16,9 @@
Module Info class used to hold cached module-info.json.
"""
+# pylint: disable=line-too-long
+# pylint: disable=relative-import
+
import json
import logging
import os
@@ -83,8 +86,8 @@
build_env.update(constants.DEPS_LICENSE_ENV)
# Also build the deps-license module to generate dependencies data.
atest_utils.build([module_info_target, constants.DEPS_LICENSE],
- verbose=logging.getLogger().isEnabledFor(logging.DEBUG),
- env_vars=build_env)
+ verbose=logging.getLogger().isEnabledFor(
+ logging.DEBUG), env_vars=build_env)
return module_info_target, module_file_path
def _load_module_info_file(self, force_build, module_file):
@@ -221,7 +224,8 @@
A module can have a test config in the following manner:
- AndroidTest.xml at the module path.
- test_config be set in module-info.json.
- - Auto-generated config via the auto_test_config key in module-info.json.
+ - Auto-generated config via the auto_test_config key
+ in module-info.json.
Args:
mod_info: Dict of module info to check.
diff --git a/atest/module_info_unittest.py b/atest/module_info_unittest.py
index c982707..e4018df 100755
--- a/atest/module_info_unittest.py
+++ b/atest/module_info_unittest.py
@@ -16,6 +16,9 @@
"""Unittests for module_info."""
+# pylint: disable=relative-import
+# pylint: disable=line-too-long
+
import os
import unittest
import mock
diff --git a/atest/result_reporter.py b/atest/result_reporter.py
index 16da628..da6c02d 100644
--- a/atest/result_reporter.py
+++ b/atest/result_reporter.py
@@ -11,6 +11,10 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
+
+# pylint: disable=relative-import
+# pylint: disable=line-too-long
+
"""
Result Reporter
diff --git a/atest/result_reporter_unittest.py b/atest/result_reporter_unittest.py
index c703bc0..c6b98e9 100755
--- a/atest/result_reporter_unittest.py
+++ b/atest/result_reporter_unittest.py
@@ -16,6 +16,9 @@
"""Unittests for result_reporter."""
+# pylint: disable=relative-import
+# pylint: disable=line-too-long
+
import sys
import unittest
import mock
diff --git a/atest/test_finder_handler.py b/atest/test_finder_handler.py
index 360c66e..2c47f6e 100644
--- a/atest/test_finder_handler.py
+++ b/atest/test_finder_handler.py
@@ -16,6 +16,9 @@
Test Finder Handler module.
"""
+# pylint: disable=relative-import
+# pylint: disable=line-too-long
+
import logging
import atest_enum
@@ -49,7 +52,8 @@
# Same as value of "test-suite-tag" in AndroidTest.xml files.
# 10. CC_CLASS: Test case in cc file.
# 11. SUITE_PLAN: Suite name such as cts.
-# 12. SUITE_PLAN_FILE_PATH: File path to config xml in the suite config directories.
+# 12. SUITE_PLAN_FILE_PATH: File path to config xml in the suite config
+# directories.
# 13. CACHE: A pseudo type that runs cache_finder without finding test in real.
_REFERENCE_TYPE = atest_enum.AtestEnum(['MODULE', 'CLASS', 'QUALIFIED_CLASS',
'MODULE_CLASS', 'PACKAGE',
diff --git a/atest/test_finder_handler_unittest.py b/atest/test_finder_handler_unittest.py
index 6b4801e..3e0d158 100755
--- a/atest/test_finder_handler_unittest.py
+++ b/atest/test_finder_handler_unittest.py
@@ -16,6 +16,9 @@
"""Unittests for test_finder_handler."""
+# pylint: disable=relative-import
+# pylint: disable=line-too-long
+
import unittest
import mock
diff --git a/atest/test_finders/cache_finder_unittest.py b/atest/test_finders/cache_finder_unittest.py
index f37a975..2892c78 100755
--- a/atest/test_finders/cache_finder_unittest.py
+++ b/atest/test_finders/cache_finder_unittest.py
@@ -16,11 +16,13 @@
"""Unittests for cache_finder."""
+# pylint: disable=relative-import
+# pylint: disable=line-too-long
+
import unittest
import os
import mock
-# pylint: disable=import-error
import atest_utils
import unittest_constants as uc
from test_finders import cache_finder
diff --git a/atest/test_finders/module_finder.py b/atest/test_finders/module_finder.py
index ac9fdb2..4ab755f 100644
--- a/atest/test_finders/module_finder.py
+++ b/atest/test_finders/module_finder.py
@@ -16,10 +16,12 @@
Module Finder class.
"""
+# pylint: disable=relative-import
+# pylint: disable=line-too-long
+
import logging
import os
-# pylint: disable=import-error
import atest_error
import atest_utils
import constants
@@ -336,7 +338,8 @@
# path is a list with only 1 element.
rel_config = os.path.join(mod_info['path'][0],
constants.MODULE_CONFIG)
- rel_config = self._get_module_test_config(module_name, rel_config=rel_config)
+ rel_config = self._get_module_test_config(module_name,
+ rel_config=rel_config)
tinfo = self._process_test_info(test_info.TestInfo(
test_name=module_name,
test_runner=self._TEST_RUNNER,
@@ -561,9 +564,10 @@
Args:
user_input: A string of the user input.
- ld_range: An integer that range the searching scope. If the length of
- user_input is 10, then Atest will calculate modules of which
- length is between 8 and 12. 0 is equivalent to unlimited.
+ ld_range: An integer that range the searching scope. If the length
+ of user_input is 10, then Atest will calculate modules of
+ which length is between 8 and 12. 0 is equivalent to
+ unlimited.
Returns:
A List of LDs and possible module names. If the user_input is "fax",
@@ -575,7 +579,8 @@
"""
atest_utils.colorful_print('\nSearching for similar module names using '
'fuzzy search...', constants.CYAN)
- testable_modules = sorted(self.module_info.get_testable_modules(), key=len)
+ testable_modules = sorted(self.module_info.get_testable_modules(),
+ key=len)
lower_bound = len(user_input) - ld_range
upper_bound = len(user_input) + ld_range
testable_modules_with_ld = []
@@ -600,8 +605,8 @@
Return:
A list of guessed modules.
"""
- modules_with_ld = self.get_testable_modules_with_ld(user_input,
- ld_range=constants.LD_RANGE)
+ modules_with_ld = self.get_testable_modules_with_ld(
+ user_input, ld_range=constants.LD_RANGE)
guessed_modules = []
for _distance, _module in modules_with_ld:
if _distance <= abs(constants.LD_RANGE):
diff --git a/atest/test_finders/module_finder_unittest.py b/atest/test_finders/module_finder_unittest.py
index e168877..5b118e5 100755
--- a/atest/test_finders/module_finder_unittest.py
+++ b/atest/test_finders/module_finder_unittest.py
@@ -16,12 +16,14 @@
"""Unittests for module_finder."""
+# pylint: disable=relative-import
+# pylint: disable=line-too-long
+
import re
import unittest
import os
import mock
-# pylint: disable=import-error
import atest_error
import constants
import module_info
diff --git a/atest/test_finders/suite_plan_finder.py b/atest/test_finders/suite_plan_finder.py
index a33da2d..32395bf 100644
--- a/atest/test_finders/suite_plan_finder.py
+++ b/atest/test_finders/suite_plan_finder.py
@@ -152,7 +152,8 @@
if not test_files:
return None
for test_file in test_files:
- _test_info = self._get_test_info_from_path(test_file, suite_name)
+ _test_info = self._get_test_info_from_path(test_file,
+ suite_name)
if _test_info:
test_infos.append(_test_info)
return test_infos
diff --git a/atest/test_finders/suite_plan_finder_unittest.py b/atest/test_finders/suite_plan_finder_unittest.py
index db09fdb..aa764fa 100755
--- a/atest/test_finders/suite_plan_finder_unittest.py
+++ b/atest/test_finders/suite_plan_finder_unittest.py
@@ -13,13 +13,16 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
+
"""Unittests for suite_plan_finder."""
+# pylint: disable=relative-import
+# pylint: disable=line-too-long
+
import os
import unittest
import mock
-# pylint: disable=import-error
import unittest_constants as uc
import unittest_utils
from test_finders import test_finder_utils
diff --git a/atest/test_finders/test_finder_utils.py b/atest/test_finders/test_finder_utils.py
index 2e8ec64..f660b39 100644
--- a/atest/test_finders/test_finder_utils.py
+++ b/atest/test_finders/test_finder_utils.py
@@ -16,6 +16,8 @@
Utils for finder classes.
"""
+# pylint: disable=line-too-long
+
from __future__ import print_function
import logging
import multiprocessing
@@ -45,7 +47,8 @@
_JAVA_METHODS_PATTERN = r'.*[ ]+({0})\(.*'
# RE for checking if there exists one of the methods in cc file.
_CC_METHODS_PATTERN = r'^[ ]*TEST(_F|_P)?[ ]*\(.*,[ ]*({0})\).*'
-# Parse package name from the package declaration line of a java or a kotlin file.
+# Parse package name from the package declaration line of a java or
+# a kotlin file.
# Group matches "foo.bar" of line "package foo.bar;" or "package foo.bar"
_PACKAGE_RE = re.compile(r'\s*package\s+(?P<package>[^(;|\s)]+)\s*', re.I)
# Matches install paths in module_info to install location(host or device).
@@ -62,8 +65,11 @@
# 3. INTEGRATION: XML file name in one of the 4 integration config directories.
# 4. CC_CLASS: Name of a cc class.
-FIND_REFERENCE_TYPE = atest_enum.AtestEnum(['CLASS', 'QUALIFIED_CLASS',
- 'PACKAGE', 'INTEGRATION', 'CC_CLASS'])
+FIND_REFERENCE_TYPE = atest_enum.AtestEnum(['CLASS',
+ 'QUALIFIED_CLASS',
+ 'PACKAGE',
+ 'INTEGRATION',
+ 'CC_CLASS'])
# Get cpu count.
_CPU_COUNT = 0 if os.uname()[0] == 'Linux' else multiprocessing.cpu_count()
@@ -85,7 +91,8 @@
FIND_REFERENCE_TYPE.CC_CLASS: r"find {0} {1} -type f -print"
r"| egrep -i '/*test.*\.(cc|cpp)$'"
r"| xargs -P" + str(_CPU_COUNT) +
- r" egrep -sH '^[ ]*TEST(_F|_P)?[ ]*\({2}' || true"
+ r" egrep -sH '^[ ]*TEST(_F|_P)?[ ]*\({2}' "
+ " || true"
}
# Map ref_type with its index file.
@@ -519,8 +526,9 @@
return rel_dir
if mod.get('auto_test_config'):
auto_gen_dir = rel_dir
- # Don't return for auto_gen, keep checking for real config, because
- # common in cts for class in apk that's in hostside test setup.
+ # Don't return for auto_gen, keep checking for real config,
+ # because common in cts for class in apk that's in hostside
+ # test setup.
current_dir = os.path.dirname(current_dir)
return auto_gen_dir
@@ -784,8 +792,10 @@
# If the config specified append-bitness, append the bits suffixes
# to the target.
if _specified_bitness(xml_root):
- targets.add(os.path.join(rel_out_dir, push_target + _VTS_BITNESS_32))
- targets.add(os.path.join(rel_out_dir, push_target + _VTS_BITNESS_64))
+ targets.add(os.path.join(
+ rel_out_dir, push_target + _VTS_BITNESS_32))
+ targets.add(os.path.join(
+ rel_out_dir, push_target + _VTS_BITNESS_64))
else:
targets.add(os.path.join(rel_out_dir, push_target))
elif name == _VTS_TEST_FILE:
@@ -914,7 +924,8 @@
return install_locations
-def get_levenshtein_distance(test_name, module_name, dir_costs=constants.COST_TYPO):
+def get_levenshtein_distance(test_name, module_name,
+ dir_costs=constants.COST_TYPO):
"""Return an edit distance between test_name and module_name.
Levenshtein Distance has 3 actions: delete, insert and replace.
diff --git a/atest/test_finders/test_finder_utils_unittest.py b/atest/test_finders/test_finder_utils_unittest.py
index 0b1aae4..5799eae 100755
--- a/atest/test_finders/test_finder_utils_unittest.py
+++ b/atest/test_finders/test_finder_utils_unittest.py
@@ -16,11 +16,13 @@
"""Unittests for test_finder_utils."""
+# pylint: disable=relative-import
+# pylint: disable=line-too-long
+
import os
import unittest
import mock
-# pylint: disable=import-error
import atest_error
import constants
import module_info
diff --git a/atest/test_finders/tf_integration_finder.py b/atest/test_finders/tf_integration_finder.py
index eecb992..d4c008d 100644
--- a/atest/test_finders/tf_integration_finder.py
+++ b/atest/test_finders/tf_integration_finder.py
@@ -16,6 +16,8 @@
Integration Finder class.
"""
+# pylint: disable=line-too-long
+
import copy
import logging
import os
@@ -101,15 +103,17 @@
def _load_include_tags(self, root):
"""Recursively expand in-place the <include> tags in a given xml tree.
- Python xml libraries don't support our type of <include> tags. Logic used
- below is modified version of the built-in ElementInclude logic found here:
+ Python xml libraries don't support our type of <include> tags. Logic
+ used below is modified version of the built-in ElementInclude logic
+ found here:
https://github.com/python/cpython/blob/2.7/Lib/xml/etree/ElementInclude.py
Args:
root: The root xml.etree.ElementTree.Element.
Returns:
- An xml.etree.ElementTree.Element instance with include tags expanded
+ An xml.etree.ElementTree.Element instance with
+ include tags expanded.
"""
i = 0
while i < len(root):
diff --git a/atest/test_finders/tf_integration_finder_unittest.py b/atest/test_finders/tf_integration_finder_unittest.py
index 89c4f10..66173b4 100755
--- a/atest/test_finders/tf_integration_finder_unittest.py
+++ b/atest/test_finders/tf_integration_finder_unittest.py
@@ -16,11 +16,13 @@
"""Unittests for tf_integration_finder."""
+# pylint: disable=relative-import
+# pylint: disable=line-too-long
+
import os
import unittest
import mock
-# pylint: disable=import-error
import constants
import unittest_constants as uc
import unittest_utils
diff --git a/atest/test_mapping.py b/atest/test_mapping.py
index 255e813..3735a14 100644
--- a/atest/test_mapping.py
+++ b/atest/test_mapping.py
@@ -12,10 +12,9 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-"""
-Classes for test mapping related objects
-"""
+"""Classes for test mapping related objects."""
+# pylint: disable=relative-import
import copy
import os
diff --git a/atest/test_mapping_unittest.py b/atest/test_mapping_unittest.py
index 4214970..e3ae1b3 100755
--- a/atest/test_mapping_unittest.py
+++ b/atest/test_mapping_unittest.py
@@ -16,6 +16,9 @@
"""Unittests for test_mapping"""
+# pylint: disable=relative-import
+# pylint: disable=line-too-long
+
import unittest
import test_mapping
diff --git a/atest/test_runner_handler.py b/atest/test_runner_handler.py
index 86f42cb..c844a66 100644
--- a/atest/test_runner_handler.py
+++ b/atest/test_runner_handler.py
@@ -16,6 +16,9 @@
Aggregates test runners, groups tests by test runners and kicks off tests.
"""
+# pylint: disable=relative-import
+# pylint: disable=line-too-long
+
import itertools
import time
import traceback
@@ -31,7 +34,6 @@
from test_runners import suite_plan_test_runner
from test_runners import vts_tf_test_runner
-# pylint: disable=line-too-long
_TEST_RUNNERS = {
atest_tf_test_runner.AtestTradefedTestRunner.NAME: atest_tf_test_runner.AtestTradefedTestRunner,
robolectric_test_runner.RobolectricTestRunner.NAME: robolectric_test_runner.RobolectricTestRunner,
@@ -52,7 +54,6 @@
test_runners_dict = _TEST_RUNNERS
# Example import of example test runner:
try:
- # pylint: disable=line-too-long
from test_runners import example_test_runner
test_runners_dict[example_test_runner.ExampleTestRunner.NAME] = example_test_runner.ExampleTestRunner
except ImportError:
diff --git a/atest/test_runner_handler_unittest.py b/atest/test_runner_handler_unittest.py
index 467dd7f..a08f1e4 100755
--- a/atest/test_runner_handler_unittest.py
+++ b/atest/test_runner_handler_unittest.py
@@ -17,6 +17,8 @@
"""Unittests for test_runner_handler."""
# pylint: disable=protected-access
+# pylint: disable=relative-import
+# pylint: disable=line-too-long
import unittest
import mock
diff --git a/atest/test_runners/atest_tf_test_runner.py b/atest/test_runners/atest_tf_test_runner.py
index 976a0ff..abd608d 100644
--- a/atest/test_runners/atest_tf_test_runner.py
+++ b/atest/test_runners/atest_tf_test_runner.py
@@ -12,9 +12,10 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-"""
-Atest Tradefed test runner class.
-"""
+"""Atest Tradefed test runner class."""
+
+# pylint: disable=line-too-long
+# pylint: disable=relative-import
from __future__ import print_function
import json
@@ -27,7 +28,6 @@
from functools import partial
-# pylint: disable=import-error
import atest_utils
import constants
import result_reporter
@@ -63,7 +63,8 @@
EXECUTABLE = 'atest_tradefed.sh'
_TF_TEMPLATE = 'template/atest_local_min'
# Use --no-enable-granular-attempts to control reporter replay behavior.
- # TODO(b/142630648): Enable option enable-granular-attempts in sharding mode.
+ # TODO(b/142630648): Enable option enable-granular-attempts
+ # in sharding mode.
_LOG_ARGS = ('--logcat-on-failure --atest-log-file-path={log_path} '
'--no-enable-granular-attempts')
_RUN_CMD = ('{exe} {template} --template:map '
@@ -124,7 +125,8 @@
"""
reporter.log_path = self.log_path
reporter.rerun_options = self._extract_rerun_options(extra_args)
- # Set google service key if it's available or found before running tests.
+ # Set google service key if it's available or found before
+ # running tests.
self._try_set_gts_authentication_key()
if os.getenv(test_runner_base.OLD_OUTPUT_ENV_VAR):
return self.run_tests_raw(test_infos, extra_args, reporter)
@@ -200,7 +202,8 @@
conn.setblocking(False)
inputs.append(conn)
data_map[conn] = ''
- # The First connection should be invocation level reporter.
+ # The First connection should be invocation
+ # level reporter.
if not inv_socket:
inv_socket = conn
else:
@@ -209,11 +212,13 @@
if inv_socket == socket_object:
reporter.silent = True
event_handler = event_handlers.setdefault(
- socket_object, EventHandler(reporter, self.NAME))
+ socket_object, EventHandler(reporter,
+ self.NAME))
else:
event_handler = event_handlers.setdefault(
socket_object, EventHandler(
- result_reporter.ResultReporter(), self.NAME))
+ result_reporter.ResultReporter(),
+ self.NAME))
recv_data = self._process_connection(data_map,
socket_object,
event_handler)
@@ -494,8 +499,10 @@
module_args = []
for test_info_i in group:
data.update(test_info_i.data)
- # Extend data with constants.TI_MODULE_ARG instead of overwriting.
- module_args.extend(test_info_i.data.get(constants.TI_MODULE_ARG, []))
+ # Extend data with constants.TI_MODULE_ARG instead of
+ # overwriting.
+ module_args.extend(test_info_i.data.get(
+ constants.TI_MODULE_ARG, []))
test_runner = test_info_i.test_runner
test_finder = test_info_i.test_finder
build_targets |= test_info_i.build_targets
diff --git a/atest/test_runners/atest_tf_test_runner_unittest.py b/atest/test_runners/atest_tf_test_runner_unittest.py
index 3bbfda3..2bcf6a7 100755
--- a/atest/test_runners/atest_tf_test_runner_unittest.py
+++ b/atest/test_runners/atest_tf_test_runner_unittest.py
@@ -16,6 +16,9 @@
"""Unittests for atest_tf_test_runner."""
+# pylint: disable=relative-import
+# pylint: disable=line-too-long
+
import os
import sys
import tempfile
@@ -23,7 +26,6 @@
import json
import mock
-# pylint: disable=import-error
import constants
import unittest_constants as uc
import unittest_utils
diff --git a/atest/test_runners/event_handler.py b/atest/test_runners/event_handler.py
index efe0236..646b39a 100644
--- a/atest/test_runners/event_handler.py
+++ b/atest/test_runners/event_handler.py
@@ -12,9 +12,9 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-"""
-Atest test event handler class.
-"""
+"""Atest test event handler class."""
+
+# pylint: disable=line-too-long
from __future__ import print_function
from collections import deque
@@ -228,7 +228,8 @@
if self.switch_handler.has_key(event_name):
self.switch_handler[event_name](self, event_data)
else:
- # TODO(b/128875503): Implement the mechanism to inform not handled TF event.
+ # TODO(b/128875503): Implement the mechanism to inform not handled
+ # TF event.
logging.debug('Event[%s] is not processable.', event_name)
def _check_events_are_balanced(self, event_name, reporter):
diff --git a/atest/test_runners/event_handler_unittest.py b/atest/test_runners/event_handler_unittest.py
index 44c02ec..2326c63 100755
--- a/atest/test_runners/event_handler_unittest.py
+++ b/atest/test_runners/event_handler_unittest.py
@@ -16,6 +16,9 @@
"""Unittests for event_handler."""
+# pylint: disable=relative-import
+# pylint: disable=line-too-long
+
import unittest
import mock
diff --git a/atest/test_runners/example_test_runner.py b/atest/test_runners/example_test_runner.py
index dc18112..c179086 100644
--- a/atest/test_runners/example_test_runner.py
+++ b/atest/test_runners/example_test_runner.py
@@ -12,11 +12,10 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-"""
-Example test runner class.
-"""
+"""Example test runner class."""
-# pylint: disable=import-error
+# pylint: disable=relative-import
+
import test_runner_base
diff --git a/atest/test_runners/robolectric_test_runner.py b/atest/test_runners/robolectric_test_runner.py
index fa34149..ec30eff 100644
--- a/atest/test_runners/robolectric_test_runner.py
+++ b/atest/test_runners/robolectric_test_runner.py
@@ -19,6 +19,9 @@
robolectric tests will be invoked through AtestTFTestRunner.
"""
+# pylint: disable=relative-import
+# pylint: disable=line-too-long
+
import json
import logging
import os
@@ -122,20 +125,23 @@
env_vars=full_env_vars)
event_handler = EventHandler(reporter, self.NAME)
# Start polling.
- self.handle_subprocess(subproc, partial(self._exec_with_robo_polling,
- event_file,
- subproc,
- event_handler))
+ self.handle_subprocess(subproc,
+ partial(self._exec_with_robo_polling,
+ event_file,
+ subproc,
+ event_handler))
ret_code |= self.wait_for_subprocess(subproc)
return ret_code
- def _get_full_build_environ(self, test_info=None, extra_args=None, event_file=None):
+ def _get_full_build_environ(self, test_info=None, extra_args=None,
+ event_file=None):
"""Helper to get full build environment.
Args:
test_info: TestInfo object.
extra_args: Dict of extra args to add to test run.
- event_file: A file-like object that can be used as a temporary storage area.
+ event_file: A file-like object that can be used as a temporary
+ storage area.
"""
full_env_vars = os.environ.copy()
env_vars = self.generate_env_vars(test_info,
@@ -144,7 +150,8 @@
full_env_vars.update(env_vars)
return full_env_vars
- def _exec_with_robo_polling(self, communication_file, robo_proc, event_handler):
+ def _exec_with_robo_polling(self, communication_file, robo_proc,
+ event_handler):
"""Polling data from communication file
Polling data from communication file. Exit when communication file
@@ -194,7 +201,8 @@
Args:
test_info: TestInfo class that holds the class filter info.
extra_args: Dict of extra args to apply for test run.
- event_file: A file-like object storing the events of robolectric tests.
+ event_file: A file-like object storing the events of robolectric
+ tests.
Returns:
Dict of env vars to pass into invocation.
diff --git a/atest/test_runners/robolectric_test_runner_unittest.py b/atest/test_runners/robolectric_test_runner_unittest.py
index 1ccb7a2..efe79e3 100755
--- a/atest/test_runners/robolectric_test_runner_unittest.py
+++ b/atest/test_runners/robolectric_test_runner_unittest.py
@@ -13,8 +13,12 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
+
"""Unittests for robolectric_test_runner."""
+# pylint: disable=relative-import
+# pylint: disable=line-too-long
+
import json
import unittest
import subprocess
@@ -22,7 +26,6 @@
import mock
import event_handler
-# pylint: disable=import-error
from test_finders import test_info
from test_runners import robolectric_test_runner
diff --git a/atest/test_runners/suite_plan_test_runner_unittest.py b/atest/test_runners/suite_plan_test_runner_unittest.py
index 84e2c14..939138e 100755
--- a/atest/test_runners/suite_plan_test_runner_unittest.py
+++ b/atest/test_runners/suite_plan_test_runner_unittest.py
@@ -13,12 +13,15 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
+
"""Unittests for test_suite_test_runner."""
+# pylint: disable=relative-import
+# pylint: disable=line-too-long
+
import unittest
import mock
-# pylint: disable=import-error
import suite_plan_test_runner
import unittest_utils
from test_finders import test_info
diff --git a/atest/test_runners/test_runner_base.py b/atest/test_runners/test_runner_base.py
index 22994e3..ec6d8ef 100644
--- a/atest/test_runners/test_runner_base.py
+++ b/atest/test_runners/test_runner_base.py
@@ -81,13 +81,12 @@
env_vars: Environment variables passed to the subprocess.
"""
if not output_to_stdout:
- self.test_log_file = tempfile.NamedTemporaryFile(mode='w',
- dir=self.results_dir,
- delete=True)
+ self.test_log_file = tempfile.NamedTemporaryFile(
+ mode='w', dir=self.results_dir, delete=True)
logging.debug('Executing command: %s', cmd)
return subprocess.Popen(cmd, preexec_fn=os.setsid, shell=True,
- stderr=subprocess.STDOUT, stdout=self.test_log_file,
- env=env_vars)
+ stderr=subprocess.STDOUT,
+ stdout=self.test_log_file, env=env_vars)
# pylint: disable=broad-except
def handle_subprocess(self, subproc, func):
@@ -138,7 +137,8 @@
Return code of the subprocess for running tests.
"""
try:
- logging.debug('Runner Name: %s, Process ID: %s', self.NAME, proc.pid)
+ logging.debug('Runner Name: %s, Process ID: %s',
+ self.NAME, proc.pid)
signal.signal(signal.SIGINT, self._signal_passer(proc))
proc.wait()
return proc.returncode
diff --git a/atest/test_runners/vts_tf_test_runner_unittest.py b/atest/test_runners/vts_tf_test_runner_unittest.py
index 8009cdd..7905547 100755
--- a/atest/test_runners/vts_tf_test_runner_unittest.py
+++ b/atest/test_runners/vts_tf_test_runner_unittest.py
@@ -13,12 +13,15 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
+
"""Unittests for vts_tf_test_runner."""
+# pylint: disable=relative-import
+# pylint: disable=line-too-long
+
import unittest
import mock
-# pylint: disable=import-error
from test_runners import vts_tf_test_runner
# pylint: disable=protected-access
diff --git a/atest/tools/atest_tools.py b/atest/tools/atest_tools.py
index d74ec2b..6e87ec3 100755
--- a/atest/tools/atest_tools.py
+++ b/atest/tools/atest_tools.py
@@ -13,9 +13,9 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-"""
-Atest tool functions.
-"""
+"""Atest tool functions."""
+
+# pylint: disable=line-too-long
from __future__ import print_function
@@ -138,7 +138,8 @@
dump_file: A string of absolute path of the index file.
output: A string generated by locate and grep.
output_re: An regex which is used for grouping patterns.
- key: A string for dictionary key, e.g. classname, package, cc_class, etc.
+ key: A string for dictionary key, e.g. classname, package,
+ cc_class, etc.
value: A set of path.
The data structure will be like:
@@ -152,7 +153,8 @@
for entry in output.splitlines():
match = output_re.match(entry)
if match:
- _dict.setdefault(match.group(key), set()).add(match.group(value))
+ _dict.setdefault(match.group(key), set()).add(
+ match.group(value))
try:
pickle.dump(_dict, cache_file, protocol=2)
except IOError:
@@ -195,7 +197,8 @@
find_java_cmd = find_cmd + '| xargs egrep -sH \'%s\' || true' % package_grep_re
logging.debug('Probing Java classes:\n %s', find_java_cmd)
return subprocess.check_output('echo \"%s\" > %s; sh %s'
- % (find_java_cmd, TMPRUN, TMPRUN), shell=True)
+ % (find_java_cmd, TMPRUN, TMPRUN),
+ shell=True)
def _index_testable_modules(index):
"""Dump testable modules read by tab completion.
@@ -300,7 +303,8 @@
generated in this method.
Args:
- output_cache: A file path of the updatedb cache(e.g. /path/to/mlocate.db).
+ output_cache: A file path of the updatedb cache
+ (e.g. /path/to/mlocate.db).
kwargs: (optional)
class_index: A path string of the Java class index.
qclass_index: A path string of the qualified class index.
diff --git a/atest/tools/atest_tools_unittest.py b/atest/tools/atest_tools_unittest.py
index 3fd4dc6..19eac26 100755
--- a/atest/tools/atest_tools_unittest.py
+++ b/atest/tools/atest_tools_unittest.py
@@ -16,6 +16,9 @@
"""Unittest for atest_tools."""
+# pylint: disable=relative-import
+# pylint: disable=line-too-long
+
import os
import pickle
import platform
diff --git a/atest/unittest_constants.py b/atest/unittest_constants.py
index c757936..8cbcb30 100644
--- a/atest/unittest_constants.py
+++ b/atest/unittest_constants.py
@@ -21,6 +21,9 @@
constant, do so with care and run all unittests to make sure nothing breaks.
"""
+# pylint: disable=relative-import
+# pylint: disable=line-too-long
+
import os
import constants
diff --git a/atest/unittest_utils.py b/atest/unittest_utils.py
index 605f44d..0dee4ab 100644
--- a/atest/unittest_utils.py
+++ b/atest/unittest_utils.py
@@ -14,6 +14,9 @@
"""Utility functions for unit tests."""
+# pylint: disable=relative-import
+# pylint: disable=line-too-long
+
import os
import constants