aboutsummaryrefslogtreecommitdiff
path: root/tests/mobly/controllers/android_device_lib/jsonrpc_shell_base_test.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/mobly/controllers/android_device_lib/jsonrpc_shell_base_test.py')
-rwxr-xr-xtests/mobly/controllers/android_device_lib/jsonrpc_shell_base_test.py25
1 files changed, 15 insertions, 10 deletions
diff --git a/tests/mobly/controllers/android_device_lib/jsonrpc_shell_base_test.py b/tests/mobly/controllers/android_device_lib/jsonrpc_shell_base_test.py
index 8ac7b78..2cdcd5c 100755
--- a/tests/mobly/controllers/android_device_lib/jsonrpc_shell_base_test.py
+++ b/tests/mobly/controllers/android_device_lib/jsonrpc_shell_base_test.py
@@ -37,8 +37,9 @@ class JsonRpcClientBaseTest(unittest.TestCase):
@mock.patch.object(android_device, 'list_adb_devices')
@mock.patch.object(android_device, 'get_instances')
@mock.patch.object(os, 'environ', new={})
- def test_load_device_when_one_device(self, mock_get_instances,
- mock_list_adb_devices):
+ def test_load_device_when_one_device(
+ self, mock_get_instances, mock_list_adb_devices
+ ):
mock_list_adb_devices.return_value = ['1234']
mock_device = mock.MagicMock(spec=android_device.AndroidDevice)
mock_get_instances.return_value = [mock_device]
@@ -49,8 +50,9 @@ class JsonRpcClientBaseTest(unittest.TestCase):
@mock.patch.object(android_device, 'list_adb_devices')
@mock.patch.object(android_device, 'get_instances')
@mock.patch.object(os, 'environ', new={'ANDROID_SERIAL': '1234'})
- def test_load_device_when_android_serial(self, mock_get_instances,
- mock_list_adb_devices):
+ def test_load_device_when_android_serial(
+ self, mock_get_instances, mock_list_adb_devices
+ ):
mock_list_adb_devices.return_value = ['1234', '4321']
mock_device = mock.MagicMock(spec=android_device.AndroidDevice)
mock_get_instances.return_value = [mock_device]
@@ -62,8 +64,9 @@ class JsonRpcClientBaseTest(unittest.TestCase):
def test_load_device_when_no_devices(self, mock_list_adb_devices):
mock_list_adb_devices.return_value = []
json_shell = jsonrpc_shell_base.JsonRpcShellBase()
- with self.assertRaisesRegex(jsonrpc_shell_base.Error,
- 'No adb device found!'):
+ with self.assertRaisesRegex(
+ jsonrpc_shell_base.Error, 'No adb device found!'
+ ):
json_shell.load_device()
@mock.patch.object(android_device, 'list_adb_devices')
@@ -71,8 +74,9 @@ class JsonRpcClientBaseTest(unittest.TestCase):
def test_load_device_when_unspecified_device(self, mock_list_adb_devices):
mock_list_adb_devices.return_value = ['1234', '4321']
json_shell = jsonrpc_shell_base.JsonRpcShellBase()
- with self.assertRaisesRegex(jsonrpc_shell_base.Error,
- 'Expected one phone.*'):
+ with self.assertRaisesRegex(
+ jsonrpc_shell_base.Error, 'Expected one phone.*'
+ ):
json_shell.load_device()
@mock.patch.object(android_device, 'list_adb_devices')
@@ -80,8 +84,9 @@ class JsonRpcClientBaseTest(unittest.TestCase):
def test_load_device_when_device_not_found(self, mock_list_adb_devices):
mock_list_adb_devices.return_value = ['4321']
json_shell = jsonrpc_shell_base.JsonRpcShellBase()
- with self.assertRaisesRegex(jsonrpc_shell_base.Error,
- 'Device "1234" is not found by adb.'):
+ with self.assertRaisesRegex(
+ jsonrpc_shell_base.Error, 'Device "1234" is not found by adb.'
+ ):
json_shell.load_device(serial='1234')