-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Revert "Use async ADB server code from pure-python-adb (#193)" This reverts commit 52864be. * No need to catch index errors * Update docstrings * Checkout setup.py from master * pylint fix
- Loading branch information
1 parent
9ab0e5b
commit e29c535
Showing
2 changed files
with
85 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import sys | ||
import unittest | ||
from unittest.mock import patch | ||
|
||
sys.path.insert(0, '..') | ||
|
||
from androidtv.adb_manager.adb_manager_async import ClientAsync | ||
|
||
from .async_wrapper import awaiter | ||
from . import patchers | ||
|
||
|
||
class TestAsyncClientDevice(unittest.TestCase): | ||
"""Test the ``ClientAsync`` and ``DeviceAsync`` classes defined in ``adb_manager_async.py``. | ||
This file can be removed once true async support for using an ADB server is available. | ||
""" | ||
|
||
@awaiter | ||
async def test_async_client_device(self): | ||
with patch("androidtv.adb_manager.adb_manager_async.Client", patchers.ClientFakeSuccess): | ||
client = ClientAsync("host", "port") | ||
|
||
device = await client.device("serial") | ||
|
||
with patch("{}.DeviceFake.shell".format(patchers.__name__)): | ||
await device.shell("test") | ||
|
||
with patch("{}.DeviceFake.push".format(patchers.__name__)): | ||
await device.push("local_path", "device_path") | ||
|
||
with patch("{}.DeviceFake.pull".format(patchers.__name__)): | ||
await device.pull("device_path", "local_path") | ||
|
||
with patch("{}.DeviceFake.screencap".format(patchers.__name__)): | ||
await device.screencap() | ||
|
||
@awaiter | ||
async def test_async_client_device_fail(self): | ||
with patch("androidtv.adb_manager.adb_manager_async.Client", patchers.ClientFakeFail): | ||
client = ClientAsync("host", "port") | ||
|
||
device = await client.device("serial") | ||
|
||
self.assertFalse(device) |