Open 986379041 opened 1 year ago
有几个模块不可以,tidevice应该不可以,有部分代码是基于0.9.7去二次开发的,他们后面好像修改了部分代码结构,不兼容了
但如果我使用wda驱动iOS设备的话,得tidevice==0.11.0,不然wda.USBClient(udid=confrun.Config.iOS_udid)就会连不上,但我在tidevice==0.11.0版本上使用solox没有问题,不知道我的用法涉及到不兼容地方没有:
def __init__(self, pkgName, deviceId=None, platform=confrun.Scene.Android.value):
if platform == confrun.Scene.Android.value:
if deviceId is None:
deviceId = my_adb.device_id()
wait_times = 0
while wait_times <= 20:
if my_adb.app_pid() != '':
break
wait_times += 1
log.info(f'获取不到pid,正在重试...{wait_times}')
my_u2.sleep(0.5)
self.mem = Memory(pkgName=pkgName, deviceId=deviceId, platform=platform)
self.cpu = CPU(pkgName=pkgName, deviceId=deviceId, platform=platform)
self.battery = Battery(deviceId=deviceId, platform=platform)
self.flow = Network(pkgName=pkgName, deviceId=deviceId, platform=platform)
self.fps = FPS(pkgName=pkgName, deviceId=deviceId, platform=platform)
# self.gpu = GPU(pkgName=pkgName) # 仅iOS
def get_mem(self):
"""
获取内存信息
"""
mem_list = []
time_list = []
try:
while confrun.PerfConfig.threadLock and confrun.PerfConfig.perf_error is False:
mem_res = self.mem.getProcessMem(noLog=True)
now_time = common.get_current_time()
log.trace(f'{now_time} : MEM{mem_res}')
mem_list.append(tuple(mem_res))
time_list.append(now_time)
except Exception as e:
confrun.PerfConfig.perf_error = True
error_info = f"Error in get_mem: {e}"
cache.set({'perf_error': error_info})
return time_list, mem_list
我也有点忘了,但是以前好像有人提过几个问题,都是升级tidevice后会报错
忘了说了,确实iOS上用tidevice==0.11.0时会有问题,所以我曲线救国了下,iOS用了tidevice的方法(\笑哭了)
class TidevicePerf:
"""只有iOS可用的性能获取"""
def __init__(self):
self.t = tidevice.Device()
self.perf = tidevice.Performance(self.t, [DataType.CPU, DataType.MEMORY, DataType.FPS])
def callback(self, _type, value: dict):
if _type.value == 'cpu':
log.trace(f'cpu:{value}')
self.cpu_time_list.append(common.format_time(value['timestamp']))
self.cpu_list.append((round(value['value'], 2), round(value['sys_value'], 2)))
elif _type.value == 'memory':
log.trace(f'mem:{value}')
self.mem_time_list.append(common.format_time(value['timestamp']))
self.mem_list.append((round(value['value'], 2), 0, 0))
elif _type.value == 'fps':
log.trace(f'fps:{value}')
self.fps_time_list.append(common.format_time(value['timestamp']))
self.fps_list.append((value['value'], 0))
def start(self, pkgName=confrun.package_name()):
self.mem_list = []
self.mem_time_list = []
self.cpu_list = []
self.cpu_time_list = []
self.fps_list = []
self.fps_time_list = []
self.perf.start(bundle_id=pkgName, callback=self.callback)
def stop(self):
self.perf.stop()
cache.set({'cpu_info': (self.cpu_time_list, self.cpu_list)})
cache.set({'mem_info': (self.mem_time_list, self.mem_list)})
cache.set({'fps_info': (self.fps_time_list, self.fps_list)})
solox==2.7.2
- Jinja2 [required: ==3.0.1, installed: 3.1.2] | - tidevice [required: ==0.9.7, installed: 0.11.0]
使用特定的venv呢
独奏==2.7.2
- Jinja2 [必需:==3.0.1,已安装:3.1.2] | - tidevice [必需:==0.9.7,已安装:0.11.0]
使用特定的venv呢
当我在setup文件中有冲突时,就会报错:
ERROR: Cannot install seldom because these package versions have conflicting dependencies.
The conflict is caused by:
solox 2.7.2 depends on Jinja2==3.0.1
xtestrunner 1.7.0 depends on jinja2<4.0.0 and >=3.1.2
To fix this you could try to:
1. loosen the range of package versions you've specified
2. remove package versions to allow pip attempt to solve the dependency conflict
ERROR: ResolutionImpossible: for help visit https://pip.pypa.io/en/latest/topics/dependency-resolution/#dealing-with-dependency-conflicts
solox==2.7.2