| Index: build/android/pylib/device/decorators_test.py
|
| diff --git a/build/android/pylib/device/decorators_test.py b/build/android/pylib/device/decorators_test.py
|
| index b75618b09e60d3160869dfd4130fd70f5e795a95..ec167ae014a6759e4e539f4f223911c0bc1a48f4 100644
|
| --- a/build/android/pylib/device/decorators_test.py
|
| +++ b/build/android/pylib/device/decorators_test.py
|
| @@ -19,12 +19,6 @@ from pylib.device import decorators
|
| from pylib.device import device_errors
|
| from pylib.utils import reraiser_thread
|
|
|
| -# TODO(jbudorick) Remove once the DeviceUtils implementations are no longer
|
| -# backed by AndroidCommands / android_testrunner.
|
| -sys.path.append(os.path.join(constants.DIR_SOURCE_ROOT, 'third_party',
|
| - 'android_testrunner'))
|
| -import errors as old_errors
|
| -
|
| _DEFAULT_TIMEOUT = 30
|
| _DEFAULT_RETRIES = 3
|
|
|
| @@ -78,26 +72,6 @@ class DecoratorsTest(unittest.TestCase):
|
| self.assertEquals(expected_timeout, actual_timeout)
|
| self.assertEquals(expected_retries, actual_retries)
|
|
|
| - def testFunctionDecoratorTranslatesOldExceptions(self):
|
| - """Tests that the explicit decorator translates old exceptions."""
|
| - @decorators.WithTimeoutAndRetries
|
| - def alwaysRaisesProvidedException(exception, timeout=None, retries=None):
|
| - raise exception
|
| -
|
| - exception_desc = 'Old response timeout error'
|
| - with self.assertRaises(device_errors.CommandTimeoutError) as e:
|
| - alwaysRaisesProvidedException(
|
| - old_errors.WaitForResponseTimedOutError(exception_desc),
|
| - timeout=10, retries=1)
|
| - self.assertEquals(exception_desc, str(e.exception))
|
| -
|
| - exception_desc = 'Old device error'
|
| - with self.assertRaises(device_errors.DeviceUnreachableError) as e:
|
| - alwaysRaisesProvidedException(
|
| - old_errors.DeviceUnresponsiveError(exception_desc),
|
| - timeout=10, retries=1)
|
| - self.assertEquals(exception_desc, str(e.exception))
|
| -
|
| def testFunctionDecoratorTranslatesReraiserExceptions(self):
|
| """Tests that the explicit decorator translates reraiser exceptions."""
|
| @decorators.WithTimeoutAndRetries
|
| @@ -166,24 +140,6 @@ class DecoratorsTest(unittest.TestCase):
|
| self.assertEquals(10, alwaysReturnsRetries())
|
| self.assertEquals(1, alwaysReturnsRetries(retries=1))
|
|
|
| - def testDefaultsFunctionDecoratorTranslatesOldExceptions(self):
|
| - """Tests that the explicit decorator translates old exceptions."""
|
| - @decorators.WithTimeoutAndRetriesDefaults(30, 10)
|
| - def alwaysRaisesProvidedException(exception, timeout=None, retries=None):
|
| - raise exception
|
| -
|
| - exception_desc = 'Old response timeout error'
|
| - with self.assertRaises(device_errors.CommandTimeoutError) as e:
|
| - alwaysRaisesProvidedException(
|
| - old_errors.WaitForResponseTimedOutError(exception_desc))
|
| - self.assertEquals(exception_desc, str(e.exception))
|
| -
|
| - exception_desc = 'Old device error'
|
| - with self.assertRaises(device_errors.DeviceUnreachableError) as e:
|
| - alwaysRaisesProvidedException(
|
| - old_errors.DeviceUnresponsiveError(exception_desc))
|
| - self.assertEquals(exception_desc, str(e.exception))
|
| -
|
| def testDefaultsFunctionDecoratorTranslatesReraiserExceptions(self):
|
| """Tests that the explicit decorator translates reraiser exceptions."""
|
| @decorators.WithTimeoutAndRetriesDefaults(30, 10)
|
| @@ -223,24 +179,6 @@ class DecoratorsTest(unittest.TestCase):
|
| alwaysRaisesCommandFailedError()
|
| self.assertEquals(11, DecoratorsTest._decorated_function_called_count)
|
|
|
| - def testExplicitDecoratorTranslatesOldExceptions(self):
|
| - """Tests that the explicit decorator translates old exceptions."""
|
| - @decorators.WithExplicitTimeoutAndRetries(30, 10)
|
| - def alwaysRaisesProvidedException(exception):
|
| - raise exception
|
| -
|
| - exception_desc = 'Old response timeout error'
|
| - with self.assertRaises(device_errors.CommandTimeoutError) as e:
|
| - alwaysRaisesProvidedException(
|
| - old_errors.WaitForResponseTimedOutError(exception_desc))
|
| - self.assertEquals(exception_desc, str(e.exception))
|
| -
|
| - exception_desc = 'Old device error'
|
| - with self.assertRaises(device_errors.DeviceUnreachableError) as e:
|
| - alwaysRaisesProvidedException(
|
| - old_errors.DeviceUnresponsiveError(exception_desc))
|
| - self.assertEquals(exception_desc, str(e.exception))
|
| -
|
| def testExplicitDecoratorTranslatesReraiserExceptions(self):
|
| """Tests that the explicit decorator translates reraiser exceptions."""
|
| @decorators.WithExplicitTimeoutAndRetries(30, 10)
|
| @@ -336,21 +274,6 @@ class DecoratorsTest(unittest.TestCase):
|
| self.assertEquals(31, test_obj.alwaysReturnsRetries())
|
| self.assertEquals(32, test_obj.alwaysReturnsRetries(retries=32))
|
|
|
| - def testMethodDecoratorTranslatesOldExceptions(self):
|
| - test_obj = self._MethodDecoratorTestObject(self)
|
| -
|
| - exception_desc = 'Old response timeout error'
|
| - with self.assertRaises(device_errors.CommandTimeoutError) as e:
|
| - test_obj.alwaysRaisesProvidedException(
|
| - old_errors.WaitForResponseTimedOutError(exception_desc))
|
| - self.assertEquals(exception_desc, str(e.exception))
|
| -
|
| - exception_desc = 'Old device error'
|
| - with self.assertRaises(device_errors.DeviceUnreachableError) as e:
|
| - test_obj.alwaysRaisesProvidedException(
|
| - old_errors.DeviceUnresponsiveError(exception_desc))
|
| - self.assertEquals(exception_desc, str(e.exception))
|
| -
|
| def testMethodDecoratorTranslatesReraiserExceptions(self):
|
| test_obj = self._MethodDecoratorTestObject(self)
|
|
|
|
|