首页 > 解决方案 > Pytest stop_test_suite_after_n_test_failures - 显示错误

问题描述

我计划在遇到 n 次失败后停止在 PyTest 中的执行。

所以我使用了以下命令:

pytest 文件名.py -v --maxfail = 1

但它显示以下错误,无法找到解决方案。请放一些光。

错误:用法:pytest [options] [file_or_dir] [file_or_dir] [...] pytest:错误:参数 --maxfail:无效的 int 值:'=1'

标签: pythonpytest

解决方案


pytest 文件名.py -v --maxfail=1

删除了 = 附近的空格(等于符号),它就像一个魅力。


推荐阅读