[Telemetry] Enable import-error, bad-indentation, bad-whitespace lint check.
BUG=475714 Review URL: https://codereview.chromium.org/1125633002 Cr-Commit-Position: refs/heads/master@{#328163}
This commit is contained in:
tools/telemetry
pylintrc
telemetry
benchmark.pybenchmark_runner_unittest.py
core
backends
platform
image_processing
internal
actions
timeline
user_story
util
web_perf
@ -2,7 +2,7 @@
|
||||
|
||||
# Disable the message, report, category or checker with the given id(s).
|
||||
# TODO(telemetry-team): Shrink this list to as small as possible.
|
||||
disable=I0010,I0011,abstract-class-little-used,abstract-class-not-used,anomalous-backslash-in-string,bad-builtin,bad-continuation,bad-indentation,bad-str-strip-call,bad-whitespace,broad-except,cell-var-from-loop,deprecated-lambda,deprecated-module,duplicate-code,fixme,global-statement,import-error,interface-not-implemented,invalid-name,locally-enabled,logging-not-lazy,missing-docstring,no-init,no-member,no-name-in-module,no-self-use,not-callable,old-style-class,protected-access,star-args,superfluous-parens,too-few-public-methods,too-many-ancestors,too-many-arguments,too-many-branches,too-many-function-args,too-many-instance-attributes,too-many-lines,too-many-locals,too-many-public-methods,too-many-return-statements,too-many-statements,unpacking-non-sequence,unused-argument
|
||||
disable=I0010,I0011,abstract-class-little-used,abstract-class-not-used,anomalous-backslash-in-string,bad-builtin,bad-continuation,bad-str-strip-call,broad-except,cell-var-from-loop,deprecated-lambda,deprecated-module,duplicate-code,fixme,global-statement,interface-not-implemented,invalid-name,locally-enabled,logging-not-lazy,missing-docstring,no-init,no-member,no-name-in-module,no-self-use,not-callable,old-style-class,protected-access,star-args,superfluous-parens,too-few-public-methods,too-many-ancestors,too-many-arguments,too-many-branches,too-many-function-args,too-many-instance-attributes,too-many-lines,too-many-locals,too-many-public-methods,too-many-return-statements,too-many-statements,unpacking-non-sequence,unused-argument
|
||||
|
||||
|
||||
[REPORTS]
|
||||
|
@ -44,11 +44,11 @@ class BenchmarkMetadata(object):
|
||||
|
||||
@property
|
||||
def description(self):
|
||||
return self._description
|
||||
return self._description
|
||||
|
||||
@property
|
||||
def rerun_options(self):
|
||||
return self._rerun_options
|
||||
return self._rerun_options
|
||||
|
||||
|
||||
class Benchmark(command_line.Command):
|
||||
|
@ -56,7 +56,7 @@ class BenchmarkRunnerUnittest(unittest.TestCase):
|
||||
' BarBenchmarkkkkk Benchmark Bar for testing long description line.\n'
|
||||
'Pass --browser to list benchmarks for another browser.\n\n')
|
||||
with mock.patch('telemetry.benchmark_runner.decorators') as mock_module:
|
||||
def FakeIsEnabled(benchmark_class, _):
|
||||
def FakeIsEnabled(benchmark_class, _):
|
||||
if benchmark_class is BenchmarkFoo:
|
||||
return True, None
|
||||
else:
|
||||
|
@ -161,7 +161,7 @@ class DevToolsClientBackend(object):
|
||||
Raises:
|
||||
devtools_http.DevToolsClientConnectionError
|
||||
"""
|
||||
contexts = self._ListInspectableContexts()
|
||||
contexts = self._ListInspectableContexts()
|
||||
return tab_id in [c['id'] for c in contexts]
|
||||
|
||||
def GetUpdatedInspectableContexts(self):
|
||||
|
@ -344,7 +344,7 @@ class TrybotBrowserFinderTest(unittest.TestCase):
|
||||
|
||||
def test_config_android(self):
|
||||
config = self._GetConfigForBrowser(
|
||||
'trybot-android-nexus4', 'android','somebranch',
|
||||
'trybot-android-nexus4', 'android', 'somebranch',
|
||||
'tools/run-perf-test.cfg')
|
||||
self.assertEquals(
|
||||
('config = {\n'
|
||||
|
@ -153,7 +153,7 @@ class LinuxBasedPlatformBackend(platform_backend.PlatformBackend):
|
||||
Multi-CPU machines will have multiple 'jiffies:' lines, all of which will be
|
||||
essentially the same. Return the first one."""
|
||||
jiffies_timer_lines = self.RunCommand(
|
||||
['grep', 'jiffies','/proc/timer_list'])
|
||||
['grep', 'jiffies', '/proc/timer_list'])
|
||||
if not jiffies_timer_lines:
|
||||
raise Exception('Unable to find jiffies from /proc/timer_list')
|
||||
jiffies_timer_list = jiffies_timer_lines.splitlines()
|
||||
|
@ -66,7 +66,7 @@ jiffies a1111
|
||||
result = backend.GetCpuTimestamp()
|
||||
self.assertEquals(result, {'TotalTime': 105054633.0})
|
||||
mock_method.assert_call_once_with(
|
||||
['grep', '-m', '1', 'jiffies:','/proc/timer_list'])
|
||||
['grep', '-m', '1', 'jiffies:', '/proc/timer_list'])
|
||||
|
||||
def testGetMemoryStatsBasic(self):
|
||||
if not linux_based_platform_backend.resource:
|
||||
|
@ -57,24 +57,24 @@ class PosixPlatformBackendTest(unittest.TestCase):
|
||||
posix_platform_backend._BinaryExistsInSudoersFiles(binary_path, ''))
|
||||
self.assertFalse(
|
||||
posix_platform_backend._BinaryExistsInSudoersFiles(
|
||||
binary_path,' (ALL) ALL'))
|
||||
binary_path, ' (ALL) ALL'))
|
||||
self.assertFalse(
|
||||
posix_platform_backend._BinaryExistsInSudoersFiles(
|
||||
binary_path,' (root) NOPASSWD: /usr/bin/pkill_DUMMY'))
|
||||
binary_path, ' (root) NOPASSWD: /usr/bin/pkill_DUMMY'))
|
||||
self.assertFalse(
|
||||
posix_platform_backend._BinaryExistsInSudoersFiles(
|
||||
binary_path,' (root) NOPASSWD: pkill'))
|
||||
binary_path, ' (root) NOPASSWD: pkill'))
|
||||
|
||||
|
||||
self.assertTrue(
|
||||
posix_platform_backend._BinaryExistsInSudoersFiles(
|
||||
binary_path,'(root) NOPASSWD: /usr/bin/pkill'))
|
||||
binary_path, '(root) NOPASSWD: /usr/bin/pkill'))
|
||||
self.assertTrue(
|
||||
posix_platform_backend._BinaryExistsInSudoersFiles(
|
||||
binary_path,' (root) NOPASSWD: /usr/bin/pkill'))
|
||||
binary_path, ' (root) NOPASSWD: /usr/bin/pkill'))
|
||||
self.assertTrue(
|
||||
posix_platform_backend._BinaryExistsInSudoersFiles(
|
||||
binary_path,' (root) NOPASSWD: /usr/bin/pkill arg1 arg2'))
|
||||
binary_path, ' (root) NOPASSWD: /usr/bin/pkill arg1 arg2'))
|
||||
|
||||
@decorators.Enabled('linux', 'mac')
|
||||
def testIsApplicationRunning(self):
|
||||
|
@ -50,9 +50,9 @@ class HistogramDistanceTest(unittest.TestCase):
|
||||
|
||||
class HistogramTest(unittest.TestCase):
|
||||
def testHistogram(self):
|
||||
pixels = [1,2,3, 1,2,3, 1,2,3, 1,2,3,
|
||||
1,2,3, 8,7,6, 5,4,6, 1,2,3,
|
||||
1,2,3, 8,7,6, 5,4,6, 1,2,3]
|
||||
pixels = [1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3,
|
||||
1, 2, 3, 8, 7, 6, 5, 4, 6, 1, 2, 3,
|
||||
1, 2, 3, 8, 7, 6, 5, 4, 6, 1, 2, 3]
|
||||
bmp = image_util.FromRGBPixels(4, 3, pixels)
|
||||
bmp = image_util.Crop(bmp, 1, 1, 2, 2)
|
||||
|
||||
@ -70,9 +70,9 @@ class HistogramTest(unittest.TestCase):
|
||||
self.assertEquals(hist.b[6], 4)
|
||||
|
||||
def testHistogramIgnoreColor(self):
|
||||
pixels = [1,2,3, 1,2,3, 1,2,3, 1,2,3,
|
||||
1,2,3, 8,7,6, 5,4,6, 1,2,3,
|
||||
1,2,3, 8,7,6, 5,4,6, 1,2,3]
|
||||
pixels = [1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3,
|
||||
1, 2, 3, 8, 7, 6, 5, 4, 6, 1, 2, 3,
|
||||
1, 2, 3, 8, 7, 6, 5, 4, 6, 1, 2, 3]
|
||||
bmp = image_util.FromRGBPixels(4, 3, pixels)
|
||||
|
||||
hist = image_util.GetColorHistogram(bmp,
|
||||
@ -87,8 +87,8 @@ class HistogramTest(unittest.TestCase):
|
||||
self.assertEquals(hist.b[6], 4)
|
||||
|
||||
def testHistogramIgnoreColorTolerance(self):
|
||||
pixels = [1,2,3, 4,5,6,
|
||||
7,8,9, 8,7,6]
|
||||
pixels = [1, 2, 3, 4, 5, 6,
|
||||
7, 8, 9, 8, 7, 6]
|
||||
bmp = image_util.FromRGBPixels(2, 2, pixels)
|
||||
|
||||
hist = image_util.GetColorHistogram(
|
||||
@ -106,8 +106,8 @@ class HistogramTest(unittest.TestCase):
|
||||
self.assertEquals(hist.b[9], 1)
|
||||
|
||||
def testHistogramDistanceIgnoreColor(self):
|
||||
pixels = [1,2,3, 1,2,3,
|
||||
1,2,3, 1,2,3]
|
||||
pixels = [1, 2, 3, 1, 2, 3,
|
||||
1, 2, 3, 1, 2, 3]
|
||||
bmp = image_util.FromRGBPixels(2, 2, pixels)
|
||||
|
||||
hist1 = image_util.GetColorHistogram(bmp, ignore_color=RgbaColor(1, 2, 3))
|
||||
|
@ -174,7 +174,7 @@ def GetColorHistogram(image, ignore_color, tolerance):
|
||||
in_range = ((filtered[:, 0] < colorm[0]) | (filtered[:, 0] > colorp[0]) |
|
||||
(filtered[:, 1] < colorm[1]) | (filtered[:, 1] > colorp[1]) |
|
||||
(filtered[:, 2] < colorm[2]) | (filtered[:, 2] > colorp[2]))
|
||||
filtered = np.compress(in_range, filtered, axis = 0)
|
||||
filtered = np.compress(in_range, filtered, axis=0)
|
||||
if len(filtered[:, 0]) == 0:
|
||||
return histogram.ColorHistogram(np.zeros((256)), np.zeros((256)),
|
||||
np.zeros((256)), ignore_color)
|
||||
|
@ -57,8 +57,8 @@ class ImageUtilTest(unittest.TestCase):
|
||||
orig, temp_file)
|
||||
|
||||
def testWriteCroppedBmpToPngFile(self):
|
||||
pixels = [255,0,0, 255,255,0, 0,0,0,
|
||||
255,255,0, 0,255,0, 0,0,0]
|
||||
pixels = [255, 0, 0, 255, 255, 0, 0, 0, 0,
|
||||
255, 255, 0, 0, 255, 0, 0, 0, 0]
|
||||
orig = image_util.FromRGBPixels(3, 2, pixels)
|
||||
orig = image_util.Crop(orig, 0, 0, 2, 2)
|
||||
temp_file = tempfile.NamedTemporaryFile(suffix='.png').name
|
||||
@ -102,9 +102,9 @@ class ImageUtilTest(unittest.TestCase):
|
||||
image_util.GetPixelColor(diff_bmp, 2, 2).AssertIsRGB(255, 255, 255)
|
||||
|
||||
def testGetBoundingBox(self):
|
||||
pixels = [0,0,0, 0,0,0, 0,0,0, 0,0,0,
|
||||
0,0,0, 1,0,0, 1,0,0, 0,0,0,
|
||||
0,0,0, 0,0,0, 0,0,0, 0,0,0]
|
||||
pixels = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
|
||||
bmp = image_util.FromRGBPixels(4, 3, pixels)
|
||||
box, count = image_util.GetBoundingBox(bmp, RgbaColor(1, 0, 0))
|
||||
self.assertEquals(box, (1, 1, 2, 1))
|
||||
@ -115,9 +115,9 @@ class ImageUtilTest(unittest.TestCase):
|
||||
self.assertEquals(count, 0)
|
||||
|
||||
def testCrop(self):
|
||||
pixels = [0,0,0, 1,0,0, 2,0,0, 3,0,0,
|
||||
0,1,0, 1,1,0, 2,1,0, 3,1,0,
|
||||
0,2,0, 1,2,0, 2,2,0, 3,2,0]
|
||||
pixels = [0, 0, 0, 1, 0, 0, 2, 0, 0, 3, 0, 0,
|
||||
0, 1, 0, 1, 1, 0, 2, 1, 0, 3, 1, 0,
|
||||
0, 2, 0, 1, 2, 0, 2, 2, 0, 3, 2, 0]
|
||||
bmp = image_util.FromRGBPixels(4, 3, pixels)
|
||||
bmp = image_util.Crop(bmp, 1, 2, 2, 1)
|
||||
|
||||
@ -125,4 +125,4 @@ class ImageUtilTest(unittest.TestCase):
|
||||
self.assertEquals(1, image_util.Height(bmp))
|
||||
image_util.GetPixelColor(bmp, 0, 0).AssertIsRGB(1, 2, 0)
|
||||
image_util.GetPixelColor(bmp, 1, 0).AssertIsRGB(2, 2, 0)
|
||||
self.assertEquals(image_util.Pixels(bmp), bytearray([1,2,0, 2,2,0]))
|
||||
self.assertEquals(image_util.Pixels(bmp), bytearray([1, 2, 0, 2, 2, 0]))
|
||||
|
@ -8,7 +8,7 @@ from telemetry.internal.actions import page_action
|
||||
|
||||
def read_js():
|
||||
with open(os.path.join(os.path.dirname(__file__), 'mouse_click.js')) as f:
|
||||
return f.read()
|
||||
return f.read()
|
||||
|
||||
|
||||
class MouseClickAction(page_action.PageAction):
|
||||
|
@ -10,7 +10,7 @@ from telemetry.timeline import trace_data
|
||||
|
||||
class TraceDataTest(unittest.TestCase):
|
||||
def testSerialize(self):
|
||||
ri = trace_data.TraceData({'traceEvents': [1,2,3]})
|
||||
ri = trace_data.TraceData({'traceEvents': [1, 2, 3]})
|
||||
f = cStringIO.StringIO()
|
||||
ri.Serialize(f)
|
||||
d = f.getvalue()
|
||||
@ -68,7 +68,7 @@ class TraceDataTest(unittest.TestCase):
|
||||
class TraceDataBuilderTest(unittest.TestCase):
|
||||
def testBasicChrome(self):
|
||||
builder = trace_data.TraceDataBuilder()
|
||||
builder.AddEventsTo(trace_data.CHROME_TRACE_PART, [1,2,3])
|
||||
builder.AddEventsTo(trace_data.CHROME_TRACE_PART, [1, 2, 3])
|
||||
builder.AddEventsTo(trace_data.TAB_ID_PART, ['tab-7'])
|
||||
|
||||
d = builder.AsData()
|
||||
|
@ -26,9 +26,9 @@ class SharedAppState(shared_state.SharedState):
|
||||
super(SharedAppState, self).__init__(test, finder_options, user_story_set)
|
||||
if not isinstance(
|
||||
test, timeline_based_measurement.TimelineBasedMeasurement):
|
||||
raise ValueError(
|
||||
'SharedAppState only accepts TimelineBasedMeasurement tests'
|
||||
' (not %s).' % test.__class__)
|
||||
raise ValueError(
|
||||
'SharedAppState only accepts TimelineBasedMeasurement tests'
|
||||
' (not %s).' % test.__class__)
|
||||
self._test = test
|
||||
self._finder_options = finder_options
|
||||
self._android_app = None
|
||||
|
@ -44,9 +44,9 @@ class UserStorySetTest(unittest.TestCase):
|
||||
self.assertEqual(base_dir, os.path.dirname(__file__))
|
||||
|
||||
def testFilePath(self):
|
||||
uss = UserStorySetFoo()
|
||||
self.assertEqual(os.path.abspath(__file__).replace('.pyc', '.py'),
|
||||
uss.file_path)
|
||||
uss = UserStorySetFoo()
|
||||
self.assertEqual(os.path.abspath(__file__).replace('.pyc', '.py'),
|
||||
uss.file_path)
|
||||
|
||||
def testCloudBucket(self):
|
||||
blank_uss = user_story_set.UserStorySet()
|
||||
|
@ -45,9 +45,9 @@ class CloudStorageUnitTest(unittest.TestCase):
|
||||
cloud_storage.FindGsutil = orig_find_gs_util
|
||||
|
||||
def testRunCommandCredentialsError(self):
|
||||
strs = ['You are attempting to access protected data with no configured',
|
||||
'Failure: No handler was ready to authenticate.']
|
||||
self._assertRunCommandRaisesError(strs, cloud_storage.CredentialsError)
|
||||
strs = ['You are attempting to access protected data with no configured',
|
||||
'Failure: No handler was ready to authenticate.']
|
||||
self._assertRunCommandRaisesError(strs, cloud_storage.CredentialsError)
|
||||
|
||||
def testRunCommandPermissionError(self):
|
||||
strs = ['status=403', 'status 403', '403 Forbidden']
|
||||
@ -134,7 +134,7 @@ class CloudStorageUnitTest(unittest.TestCase):
|
||||
'dir2':['2file.txt'], 'dir3':['3file1.sha1']}
|
||||
stubs.os.path.dirs = ['real_dir_path']
|
||||
def IncrementFilesUpdated(*_):
|
||||
IncrementFilesUpdated.files_updated +=1
|
||||
IncrementFilesUpdated.files_updated += 1
|
||||
IncrementFilesUpdated.files_updated = 0
|
||||
orig_get_if_changed = cloud_storage.GetIfChanged
|
||||
cloud_storage.GetIfChanged = IncrementFilesUpdated
|
||||
|
@ -17,9 +17,9 @@ TOPLEVEL_DEVICE_CATEGORY = 'disabled-by-default-gpu.device'
|
||||
SERVICE_FRAME_END_MARKER = (TOPLEVEL_SERVICE_CATEGORY, 'SwapBuffer')
|
||||
DEVICE_FRAME_END_MARKER = (TOPLEVEL_DEVICE_CATEGORY, 'SwapBuffer')
|
||||
|
||||
TRACKED_GL_CONTEXT_NAME = { 'RenderCompositor': 'render_compositor',
|
||||
'BrowserCompositor': 'browser_compositor',
|
||||
'Compositor': 'browser_compositor' }
|
||||
TRACKED_GL_CONTEXT_NAME = {'RenderCompositor': 'render_compositor',
|
||||
'BrowserCompositor': 'browser_compositor',
|
||||
'Compositor': 'browser_compositor'}
|
||||
|
||||
|
||||
class GPUTimelineListOfValues(list_of_scalar_values.ListOfScalarValues):
|
||||
@ -47,14 +47,14 @@ def _CPUFrameTimes(events_per_frame):
|
||||
# CPU event frames are calculated using the event thread duration.
|
||||
# Some platforms do not support thread_duration, convert those to 0.
|
||||
return _CalculateFrameTimes(events_per_frame,
|
||||
lambda event : event.thread_duration or 0)
|
||||
lambda event: event.thread_duration or 0)
|
||||
|
||||
|
||||
def _GPUFrameTimes(events_per_frame):
|
||||
"""Given a list of events per frame, returns a list of GPU frame times."""
|
||||
# GPU event frames are asynchronous slices which use the event duration.
|
||||
return _CalculateFrameTimes(events_per_frame,
|
||||
lambda event : event.duration)
|
||||
lambda event: event.duration)
|
||||
|
||||
|
||||
def TimelineName(name, source_type, value_type):
|
||||
|
@ -23,7 +23,7 @@ INTERACTION_RECORDS = [tir_module.TimelineInteractionRecord("test-record",
|
||||
|
||||
|
||||
def _CreateGPUSlices(parent_thread, name, start_time, duration, offset=0):
|
||||
args = { 'gl_category': gpu_timeline.TOPLEVEL_GL_CATEGORY }
|
||||
args = {'gl_category': gpu_timeline.TOPLEVEL_GL_CATEGORY}
|
||||
return (slice_module.Slice(parent_thread,
|
||||
gpu_timeline.TOPLEVEL_SERVICE_CATEGORY,
|
||||
name, start_time,
|
||||
@ -36,7 +36,7 @@ def _CreateGPUSlices(parent_thread, name, start_time, duration, offset=0):
|
||||
duration=duration))
|
||||
|
||||
def _CreateFrameEndSlices(parent_thread, start_time, duration, offset=0):
|
||||
args = { 'gl_category': gpu_timeline.TOPLEVEL_GL_CATEGORY }
|
||||
args = {'gl_category': gpu_timeline.TOPLEVEL_GL_CATEGORY}
|
||||
return (slice_module.Slice(parent_thread,
|
||||
SERVICE_FRAME_END_CATEGORY,
|
||||
SERVICE_FRAME_END_NAME,
|
||||
|
@ -135,7 +135,7 @@ class SmoothGestureTest(page_test_test_case.PageTestTestCase):
|
||||
tab_ids.append(tab.id)
|
||||
|
||||
def ValidateAndMeasurePage(self, _page, _tab, _results):
|
||||
pass
|
||||
pass
|
||||
|
||||
self.RunMeasurement(ScrollingGestureTestMeasurement(), ps)
|
||||
timeline_model = models[0]
|
||||
|
Reference in New Issue
Block a user