-
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathtest_adb.py
More file actions
41 lines (33 loc) · 1.22 KB
/
test_adb.py
File metadata and controls
41 lines (33 loc) · 1.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# -----------------------------------------------
# 测试 ADB 指令
# python ./tests/test_adb.py -p [unlock_password]
# -----------------------------------------------
# 把父级目录(项目根目录)添加到工作路径
import os
import sys
sys.path.append(os.path.dirname(os.path.abspath(__file__)) + '/../')
# ----------------------------------------------------------------------
import argparse
from src.core.adb import ADB_CLIENT, adb
from color_log.clog import log
def args() :
parser = argparse.ArgumentParser(
formatter_class=argparse.RawDescriptionHelpFormatter,
prog='测试 ADB 指令',
description='',
epilog='\r\n'.join([
'示例: ',
'python ./tests/test_adb.py'
])
)
parser.add_argument('-p', '--password', dest='password', type=str, default='123456', help='手机的锁屏密码')
return parser.parse_args()
def test(args) :
is_conn = ADB_CLIENT.test_conn() # 测试连接
log.info(f'ADB is connect: {is_conn}')
ADB_CLIENT.keep_live() # 测试探活
adb(args) # 测试打卡
if '__main__' == __name__ :
test(args())