diff options
Diffstat (limited to 'adb/test_device.py')
-rw-r--r-- | adb/test_device.py | 56 |
1 files changed, 0 insertions, 56 deletions
diff --git a/adb/test_device.py b/adb/test_device.py index ddceda9d9..4cf2206f1 100644 --- a/adb/test_device.py +++ b/adb/test_device.py @@ -34,11 +34,8 @@ import tempfile import time import unittest -import mock - import adb - def requires_root(func): def wrapper(self, *args): if self.device.get_prop('ro.debuggable') != '1': @@ -76,59 +73,6 @@ def requires_non_root(func): return wrapper -class GetDeviceTest(unittest.TestCase): - def setUp(self): - self.android_serial = os.getenv('ANDROID_SERIAL') - if 'ANDROID_SERIAL' in os.environ: - del os.environ['ANDROID_SERIAL'] - - def tearDown(self): - if self.android_serial is not None: - os.environ['ANDROID_SERIAL'] = self.android_serial - else: - if 'ANDROID_SERIAL' in os.environ: - del os.environ['ANDROID_SERIAL'] - - @mock.patch('adb.device.get_devices') - def test_explicit(self, mock_get_devices): - mock_get_devices.return_value = ['foo', 'bar'] - device = adb.get_device('foo') - self.assertEqual(device.serial, 'foo') - - @mock.patch('adb.device.get_devices') - def test_from_env(self, mock_get_devices): - mock_get_devices.return_value = ['foo', 'bar'] - os.environ['ANDROID_SERIAL'] = 'foo' - device = adb.get_device() - self.assertEqual(device.serial, 'foo') - - @mock.patch('adb.device.get_devices') - def test_arg_beats_env(self, mock_get_devices): - mock_get_devices.return_value = ['foo', 'bar'] - os.environ['ANDROID_SERIAL'] = 'bar' - device = adb.get_device('foo') - self.assertEqual(device.serial, 'foo') - - @mock.patch('adb.device.get_devices') - def test_no_such_device(self, mock_get_devices): - mock_get_devices.return_value = ['foo', 'bar'] - self.assertRaises(adb.DeviceNotFoundError, adb.get_device, ['baz']) - - os.environ['ANDROID_SERIAL'] = 'baz' - self.assertRaises(adb.DeviceNotFoundError, adb.get_device) - - @mock.patch('adb.device.get_devices') - def test_unique_device(self, mock_get_devices): - mock_get_devices.return_value = ['foo'] - device = adb.get_device() - self.assertEqual(device.serial, 'foo') - - @mock.patch('adb.device.get_devices') - def test_no_unique_device(self, mock_get_devices): - mock_get_devices.return_value = ['foo', 'bar'] - self.assertRaises(adb.NoUniqueDeviceError, adb.get_device) - - class DeviceTest(unittest.TestCase): def setUp(self): self.device = adb.get_device() |