import pytest
import os

from src.framework import dingTalk
from src.framework import common

if __name__ == '__main__':
    htmlPath = "./report/AI-XM_Report{}.html".format(common.year_to_minute())
    pytest.main(["-v", '--alluredir={}'.format(htmlPath), './src/testcase/test_WhiteBoardPage.py', "--durations=0"])
    os.system('allure generate {} -o ./report/output --clean'.format(htmlPath))
    # os.system('allure open report/output')
    dingTalk.alert()
    os.system("python -m http.server 63342 -d ./report/output")

    # # 定义报告输出路径
    # htmlPath = "./report/AI-XM_Report{}.html".format(common.year_to_minute())
    # with(open(htmlPath, 'wb')) as fp:
    #     runner = HTMLTestRunner(
    #         stream=fp,
    #         title='AI-小麦测试报告',
    #         description='描述'
    #     )
    #     runner.run(testunit)
