代码拉取完成,页面将自动刷新
import os
import subprocess
import pytest
from etc import config_path, config
from tools.get_host import get_host_ip
from tools.get_log import LOGGER
from tools.push_ddmsg import DD_Msg
from tools.utility import taskkill_port, set_allure_environment
if __name__ == '__main__':
DD_Msg.send_text('消息推送 -->> web_ui_frame 程序启动')
LOGGER.info('================================ web_ui_frame 程序启动 ================================')
host = get_host_ip()
port = '2023'
path_raw = os.path.join(config_path.path_reports, 'allure-report-raw')
path_html = os.path.join(config_path.path_reports, 'allure-report-html')
pytest.main(['-s', '--reruns=0', '-n=0', fr'--alluredir={path_raw}', '--clean-alluredir'])
set_allure_environment(path=path_raw,
str_list=[f'environment={config.ENV}', 'enterprise=WSJC',
'author=panyurong', f'platformName={config.appium_platformName}',
f'platformVersion={config.appium_platformVersion}',
f'deviceName={config.appium_deviceName}', f'appPackage={config.appium_appPackage}',
f'appActivity={config.appium_appActivity}', f'noReset={config.appium_noReset}',
f'unicodeKeyboard={config.appium_unicodeKeyboard}',
f'resetKeyboard={config.appium_resetKeyboard}', f'remote={config.appium_remote}'
]) # 设置allure报告Environment信息
subprocess.Popen(fr'allure generate {path_raw} -o {path_html} --clean', shell=True)
taskkill_port(port) # 注:打开HTML报告前,关闭该端口号进程。serve或open运行时会自动打开一个java进程,多次使用会增加内存消耗,且不能在同一个端口号反复打开HTML报告,需要主动关闭历史进程
subprocess.Popen(fr'allure serve {path_raw} -p {port}', shell=True)
subprocess.Popen(fr'exit 0', shell=True)
DD_Msg.send_text(fr'消息推送 -->> web_ui_frame 测试报告:http:/{host}:{port}/index.html')
LOGGER.info('================================ web_ui_frame 程序终止 ================================')
DD_Msg.send_text('消息推送 -->> web_ui_frame 程序终止')
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。