Files
apiautotest/case_utils/platform_handle.py

30 lines
831 B
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# -*- coding: utf-8 -*-
# @Time : 2023/5/16 16:26
# @Author : chenyinhua
# @File : platform_handle.py
# @Software: PyCharm
# @Desc: 跨平台的支持allure用于生成allure测试报告
import platform
class PlatformHandle:
"""跨平台的支持allure, webdriver"""
@property
def allure(self):
if platform.system() == "Windows":
cmd = "allure.bat"
# 生成测试报告 --clean 覆盖路径,将上次的结果覆盖掉
cmd2 = "{} generate {} -o {} --clean"
else:
cmd = "allure"
# 生成测试报告 --clean 覆盖路径,将上次的结果覆盖掉
cmd2 = "sudo {} generate {} -o {} --clean"
return cmd, cmd2
if __name__ == '__main__':
plat = PlatformHandle()
res = plat.allure[0]
print(res)