Skip to content

Commit 2b7579f

Browse files
author
Andrew Butcher
committed
updated docker compose for pyproject.toml
1 parent 9aeec01 commit 2b7579f

8 files changed

Lines changed: 22 additions & 33 deletions

File tree

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,5 @@ dist
1010
venv
1111
.venv
1212
test_result.xml
13-
.python-version
13+
.python-version
14+
build/

docker-compose.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ services:
1010
environment:
1111
- PYTHONPATH=/code
1212
- PYTHONUNBUFFERED=0
13-
command: sh -c "pip install -r requirements.txt;pip install 'Exscript';py.test test -s -v --junit-xml test_result.xml;pip install 'aiofiles>=0.4.0';py.test test_async -s -v --junit-xml test_result_async.xml;"
13+
command: sh -c "pip install .;pip install 'Exscript';py.test test -s -v --junit-xml test_result.xml;pip install 'aiofiles>=0.4.0';py.test test_async -s -v --junit-xml test_result_async.xml;"
1414

1515
emulator:
1616
image: swind/android-emulator:android_28

ppadb/device.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,17 +79,17 @@ def _pull(self, src, dest):
7979

8080
with sync_conn:
8181
return sync.pull(src, dest)
82-
82+
8383
def pull(self, src, dest):
84-
#Currently will override dest-- desired?
84+
# Currently will override dest-- desired?
8585
src = PurePosixPath(src)
8686
dest = Path(dest)
8787

8888
dir_string = "IS_DIR"
8989
res = self.shell(f"[ -d {src} ] && echo {dir_string}")
9090
if dir_string in res:
91-
#Get all files in the dir
92-
#Pull each
91+
# Get all files in the dir
92+
# Pull each
9393
dest.mkdir(exist_ok=True)
9494
cmd = f"ls -1a {src}"
9595
res = self.shell(cmd)

test/conftest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ def emulator_console_is_connectable():
9797
try:
9898
console = EmulatorConsole(host=adb_host, port=emulator_port)
9999
return console
100-
except Exception as e:
100+
except Exception:
101101
return None
102102

103103
def is_boot_completed():

test/test_device.py

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,7 @@ def progress(file_name, total_size, sent_size):
182182
assert result
183183
assert result[-1]["total_size"] == result[-1]["sent_size"]
184184

185+
185186
@pytest.fixture(scope="function")
186187
def test_filepaths():
187188
filepaths = [
@@ -194,6 +195,7 @@ def test_filepaths():
194195
]
195196
yield filepaths
196197

198+
197199
@pytest.fixture(scope="function")
198200
def populated_device(device, test_filepaths):
199201
dirpath = "toplevel/subdir1/subdir2"
@@ -206,25 +208,22 @@ def populated_device(device, test_filepaths):
206208

207209
device.shell("rm -rf /data/local/tmp/toplevel")
208210

211+
209212
@pytest.fixture(scope="function")
210213
def working_dir():
211214
with tempfile.TemporaryDirectory() as f:
212215
yield pathlib.Path(f)
213216

217+
214218
def test_pull_file(populated_device, working_dir):
215-
populated_device.pull(
216-
"/data/local/tmp/toplevel/test1.txt",
217-
working_dir
218-
)
219+
populated_device.pull("/data/local/tmp/toplevel/test1.txt", working_dir)
219220
dest_path = working_dir / "test1.txt"
220221
assert dest_path.is_file()
221222
assert dest_path.read_text() == "toplevel/test1.txt"
222223

224+
223225
def test_pull_dir(populated_device, working_dir):
224-
populated_device.pull(
225-
"/data/local/tmp/toplevel/subdir1/subdir2",
226-
working_dir
227-
)
226+
populated_device.pull("/data/local/tmp/toplevel/subdir1/subdir2", working_dir)
228227
dest_path = working_dir / "subdir2"
229228
filepath1 = dest_path / "test5.txt"
230229
filepath2 = dest_path / "test6.txt"
@@ -234,18 +233,17 @@ def test_pull_dir(populated_device, working_dir):
234233
assert filepath2.is_file()
235234
assert filepath2.read_text() == "toplevel/subdir1/subdir2/test5.txt"
236235

236+
237237
def test_pull_recursive_dir(populated_device, working_dir, test_filepaths):
238-
populated_device.pull(
239-
"data/local/tmp/toplevel",
240-
working_dir
241-
)
238+
populated_device.pull("data/local/tmp/toplevel", working_dir)
242239
assert (working_dir / "toplevel").is_dir()
243240
assert (working_dir / "toplevel" / "subdir1").is_dir()
244241
for path in test_filepaths:
245242
to_check = working_dir / path
246243
assert to_check.is_file()
247244
assert to_check.read_text() == path
248245

246+
249247
def test_forward(device):
250248
device.killforward_all()
251249
forward_map = device.list_forward()

test_async/test_client_async.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
1-
"""Unit tests for the `ClientAsync` class.
1+
"""Unit tests for the `ClientAsync` class."""
22

3-
"""
4-
5-
import asyncio
63
import sys
74
import unittest
85

test_async/test_connection_async.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
"""Unit tests for `ConnectionAsync` class.
2-
3-
"""
1+
"""Unit tests for `ConnectionAsync` class."""
42

53
import asyncio
64
import sys

test_async/test_device_async.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,9 @@
1-
"""Unit tests for the `DeviceAsync` class.
1+
"""Unit tests for the `DeviceAsync` class."""
22

3-
"""
4-
5-
import asyncio
6-
from contextlib import asynccontextmanager
73
import os
8-
import pathlib
94
import sys
105
import unittest
11-
from unittest.mock import mock_open, patch
6+
from unittest.mock import patch
127

138
sys.path.insert(0, "..")
149

0 commit comments

Comments
 (0)