1、失败重跑需要依赖pytest-rerunfailures插件,安装:pip install pytest-rerunfailures
2、命令行加个参数--reruns就行了,运行: py.test --reruns 1 --html=report.html --self-contained-html
3、运行结果: