main_
Posted 两掺豆腐脑丶
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了main_相关的知识,希望对你有一定的参考价值。
# -*- coding: utf-8 -*-
"""
@Time : 2021/12/11 17:06
@Author : zero
"""
import unittest
from time import strftime
from utils.html_test_runner import HTMLTestRunner
from utils.email_ import EmailUtil
suite = unittest.defaultTestLoader.discover(
start_dir="cases",
pattern="test_tk.py"
)
report_name = f"reports/report_strftime('%Y%m%d%H%M%S').html"
with open(report_name, "wb") as fwb:
runner = HTMLTestRunner(
stream=fwb,
title="cms接口自动化测试报告",
description="略。。。"
)
runner.run(suite)
eu = EmailUtil()
eu.send_with_html("自动化测试报告", "请下载附件查看!", report_name, ["325173141@qq.com"])
eu.close()
# eu = EmailUtil()
# eu.send_with_html("自动化测试报告", "请下载附件查看!", "./reports/report.html", ["325173141@qq.com"])
# eu.close()
以上是关于main_的主要内容,如果未能解决你的问题,请参考以下文章
为啥 def main(argv=[__name__]) 和 if __name__ == "__main__": sys.exit(main(sys.argv))?
python中的“main()”和“main(_)”有啥区别?