adbOptions.py 文件源码

python
阅读 24 收藏 0 点赞 0 评论 0

项目:Zeuz_Python_Node 作者: AutomationSolutionz 项目源码 文件源码
def get_device_storage(serial=''):
    sModuleInfo = inspect.stack()[0][3] + " : " + inspect.getmoduleinfo(__file__).name
    try:
        if serial != '': serial = '-s %s' % serial  # Prepare serial number with command line switch
        output = subprocess.check_output("adb %s shell df /data" % serial, shell=True)
        CommonUtil.ExecLog(sModuleInfo, "%s" % output, 0)
        storageList = ' '.join(output.split())
        storageList = storageList.split(" ")
        storage = storageList[6]
        storage = storage.replace('G', '')
        storage = float(storage)
        final_storage = 0
        exp = 2
        while True:
            gb = math.pow(2, exp)
            if storage < gb:
                final_storage = gb
                break
            exp += 1
        final_storage = int(final_storage)
        return final_storage

    except Exception:
        errMsg = "Unableto get device storage"
        return CommonUtil.Exception_Handler(sys.exc_info(), None, errMsg)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号