我可以在 Pytest 中重试失败的测试吗

use*_*458 10 python pytest

我可以要求在 pytest 中进行失败的测试吗?重启(重试)的次数。例如:如果 2 次尝试失败,第三次成功,则总结果成功

Sla*_*lam 15

AFAIK,这是在pytest-rerunfailures插件中实现的。看一看。

例如

$ pip install pytest-rerunfailures
$ pytest --reruns 5
Run Code Online (Sandbox Code Playgroud)