Python+Pytest框架,“main_run.py文件怎么编写“?

1、新建"main_run.py文件

python 复制代码
import pytest
import os

if __name__ == '__main__':
    # 通过pytest 运行 并且生成allure 报告,在报告里面打印需要去掉"---vs"里面的"s"!!
    # 第一步:指定运行文件,通过文件会生成结果的数据,每次运行前会清空历史数据
    # "./testcase/" 运行testcase下的所有文件,也可以指定一个文件
    pytest.main(["-vs", "./testcase/","--alluredir", "./result", "--clean-alluredir"])
    # 第二步:把数据转成测试报告(HTML)
    os.system("allure generate ./result -o ./report_allure --clean")
相关推荐
我爱娃哈哈13 小时前
SpringBoot + XXL-JOB + Quartz:任务调度双引擎选型与高可用调度平台搭建
java·spring boot·后端
小宇的天下14 小时前
Synopsys Technology File and Routing Rules Reference Manual (1)
java·服务器·前端
Coder_Boy_14 小时前
基于SpringAI的在线考试系统-AI智能化拓展
java·大数据·人工智能·spring boot
n***333514 小时前
TCP/IP协议栈深度解析技术文章大纲
java·spring boot
奋进的芋圆14 小时前
Java 线程池深度指南(JDK 17+)
java
ScilogyHunter14 小时前
SCons:Python驱动的智能构建系统
python·构建系统·scons
luoluoal14 小时前
基于python的基于深度学习的车俩特征分析系(源码+文档)
python·mysql·django·毕业设计·源码
蓁蓁啊14 小时前
GCC 头文件搜索路径:-I vs -idirafter 深度解析
java·前端·javascript·嵌入式硬件·物联网
轻竹办公PPT14 小时前
2026 年 AI 办公趋势:AI 生成 PPT 工具谁在领先
人工智能·python