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

Side by Side Diff: build/android/pylib/device/decorators_test.py

Issue 727543003: [Android] Fix new pylint errors in build/android/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 6 years, 1 month 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
« no previous file with comments | « build/android/pylib/device/adb_wrapper.py ('k') | build/android/pylib/device/device_utils.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 """ 5 """
6 Unit tests for decorators.py. 6 Unit tests for decorators.py.
7 """ 7 """
8 8
9 # pylint: disable=W0613 9 # pylint: disable=W0613
10 10
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 self.function_call_counters['alwaysTimesOut'] += 1 273 self.function_call_counters['alwaysTimesOut'] += 1
274 time.sleep(100) 274 time.sleep(100)
275 self._test_case.assertFalse(True, msg='Failed to time out?') 275 self._test_case.assertFalse(True, msg='Failed to time out?')
276 276
277 @decorators.WithTimeoutAndRetriesFromInstance( 277 @decorators.WithTimeoutAndRetriesFromInstance(
278 'default_timeout', 'default_retries') 278 'default_timeout', 'default_retries')
279 def alwaysRaisesCommandFailedError(self, timeout=None, retries=None): 279 def alwaysRaisesCommandFailedError(self, timeout=None, retries=None):
280 self.function_call_counters['alwaysRaisesCommandFailedError'] += 1 280 self.function_call_counters['alwaysRaisesCommandFailedError'] += 1
281 raise device_errors.CommandFailedError('testCommand failed') 281 raise device_errors.CommandFailedError('testCommand failed')
282 282
283 # pylint: disable=R0201 283 # pylint: disable=no-self-use
284 284
285 @decorators.WithTimeoutAndRetriesFromInstance( 285 @decorators.WithTimeoutAndRetriesFromInstance(
286 'default_timeout', 'default_retries') 286 'default_timeout', 'default_retries')
287 def alwaysReturnsTimeout(self, timeout=None, retries=None): 287 def alwaysReturnsTimeout(self, timeout=None, retries=None):
288 return timeout 288 return timeout
289 289
290 @decorators.WithTimeoutAndRetriesFromInstance( 290 @decorators.WithTimeoutAndRetriesFromInstance(
291 'default_timeout', 'default_retries') 291 'default_timeout', 'default_retries')
292 def alwaysReturnsRetries(self, timeout=None, retries=None): 292 def alwaysReturnsRetries(self, timeout=None, retries=None):
293 return retries 293 return retries
294 294
295 @decorators.WithTimeoutAndRetriesFromInstance( 295 @decorators.WithTimeoutAndRetriesFromInstance(
296 'default_timeout', 'default_retries') 296 'default_timeout', 'default_retries')
297 def alwaysRaisesProvidedException(self, exception, timeout=None, 297 def alwaysRaisesProvidedException(self, exception, timeout=None,
298 retries=None): 298 retries=None):
299 raise exception 299 raise exception
300 300
301 # pylint: enable=R0201 301 # pylint: enable=no-self-use
302 302
303 303
304 def testMethodDecoratorDoesTimeout(self): 304 def testMethodDecoratorDoesTimeout(self):
305 """Tests that the method decorator handles timeout logic.""" 305 """Tests that the method decorator handles timeout logic."""
306 test_obj = self._MethodDecoratorTestObject(self) 306 test_obj = self._MethodDecoratorTestObject(self)
307 start_time = time.time() 307 start_time = time.time()
308 with self.assertRaises(device_errors.CommandTimeoutError): 308 with self.assertRaises(device_errors.CommandTimeoutError):
309 try: 309 try:
310 test_obj.alwaysTimesOut(timeout=1, retries=0) 310 test_obj.alwaysTimesOut(timeout=1, retries=0)
311 except: 311 except:
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
356 356
357 exception_desc = 'Reraiser thread timeout error' 357 exception_desc = 'Reraiser thread timeout error'
358 with self.assertRaises(device_errors.CommandTimeoutError) as e: 358 with self.assertRaises(device_errors.CommandTimeoutError) as e:
359 test_obj.alwaysRaisesProvidedException( 359 test_obj.alwaysRaisesProvidedException(
360 reraiser_thread.TimeoutError(exception_desc)) 360 reraiser_thread.TimeoutError(exception_desc))
361 self.assertEquals(exception_desc, str(e.exception)) 361 self.assertEquals(exception_desc, str(e.exception))
362 362
363 if __name__ == '__main__': 363 if __name__ == '__main__':
364 unittest.main(verbosity=2) 364 unittest.main(verbosity=2)
365 365
OLDNEW
« no previous file with comments | « build/android/pylib/device/adb_wrapper.py ('k') | build/android/pylib/device/device_utils.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698