Пример #1
0
    logging.info("Use custom config for monkey test")
    config_file = os.path.join(wkdir, custom_config[1])
    if os.path.exists(config_file) is True:
        set_custom_config(config_file)
    else:
        logging.info(
            "Can not find .conf file, please re_check. conf file location input is: %s"
            % config_file)
        sys.exit()
else:
    logging.info("Only need one conf file, please check command line")

from performance.config.config import Config
from performance.libs.device_monitor import monitor_device

config = Config()


def run():
    logging.info('start server')
    monitor_device()


if __name__ == '__main__':
    try:
        pass
        run()
    except Exception:
        traceback.print_exc()
    finally:
        pass
Пример #2
0
import subprocess
import traceback
import imp

if __name__ == '__main__':
    project_dir = os.path.split(os.getcwd())
    project_dir = os.path.split(project_dir[0])
    sys.path.append(project_dir[0])
    os.chdir(project_dir[0])  # 将项目所在文件夹设置为 wkdir (目录下必须有 __init__.py 文件)

from performance.config.config import Config

imp.reload(sys)  #重新加载sys模块
# sys.setdefaultencoding('utf-8') #设置默认编码格式为utf-8

config = Config()  #实例化config.py下的Config()
adb = config.adb


#调用系统cmd执行adb devices命令,通过条件判断是windows系统还是其它系统,调用对应的方法。因为不同系统执行adb devices命令的方法不一样
def start_adb():
    cmd = "%s devices" % Config.adb
    if platform.system() == 'Windows':
        subprocess.check_output(cmd, shell=True)
    else:
        subprocess.getstatusoutput(cmd)
    time.sleep(2)


#这个方法可以从mac电脑获取设备id和型号
def get_info_from_mac():