gpt4 book ai didi

python - 使用 pytest 执行特定测试

转载 作者:太空宇宙 更新时间:2023-11-04 09:39:08 25 4
gpt4 key购买 nike

在 pytest 中有没有办法向测试添加属性,例如“冒烟测试”或“回归”,然后只运行这些测试?

最佳答案

是的,您可以为此使用标记。

参见 "Marking test functions and selecting them for a run"

本质上,您将使用 @pytest.mark.smoke“标记”您的一些测试,然后使用类似 $ pytest -m smoke 的命令启动它们。

关于python - 使用 pytest 执行特定测试,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52340319/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com