在 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/