Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(305)

Side by Side Diff: content/test/gpu/gpu_tests/exception_formatter.py

Issue 1413883003: Add a presubmit script and pylintrc for content/test/gpu (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address kbr's comments Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 # Copyright 2014 The Chromium Authors. All rights reserved. 1 # Copyright 2014 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 """Print prettier and more detailed exceptions. Copied from Telemetry.""" 5 """Print prettier and more detailed exceptions. Copied from Telemetry."""
6 6
7 import math 7 import math
8 import os 8 import os
9 import sys 9 import sys
10 import traceback 10 import traceback
11 11
12 import path_util 12 from gpu_tests import path_util
13 13
14 from telemetry.core import exceptions 14 from telemetry.core import exceptions
15 15
16 16
17 def PrintFormattedException(exception_class=None, exception=None, tb=None, 17 def PrintFormattedException(exception_class=None, exception=None, tb=None,
18 msg=None): 18 msg=None):
19 assert bool(exception_class) == bool(exception) == bool(tb), ( 19 assert bool(exception_class) == bool(exception) == bool(tb), (
20 'Must specify all or none of exception_class, exception, and tb') 20 'Must specify all or none of exception_class, exception, and tb')
21 21
22 if not exception_class: 22 if not exception_class:
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 if max_length < 0: 96 if max_length < 0:
97 raise ValueError('Must provide positive max_length') 97 raise ValueError('Must provide positive max_length')
98 if len(middle) > max_length: 98 if len(middle) > max_length:
99 raise ValueError('middle must not be greater than max_length') 99 raise ValueError('middle must not be greater than max_length')
100 100
101 if len(target) <= max_length: 101 if len(target) <= max_length:
102 return target 102 return target
103 half_length = (max_length - len(middle)) / 2. 103 half_length = (max_length - len(middle)) / 2.
104 return (target[:int(math.floor(half_length))] + middle + 104 return (target[:int(math.floor(half_length))] + middle +
105 target[-int(math.ceil(half_length)):]) 105 target[-int(math.ceil(half_length)):])
OLDNEW
« no previous file with comments | « content/test/gpu/gpu_tests/context_lost_expectations.py ('k') | content/test/gpu/gpu_tests/gpu_process.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698