自动化工具 pytest 深入学习的坑和建议

饶凯 · 2023年08月19日 · 2558 次阅读

1.pytest.ini 的参数配置

(1)testpath 配置

配置 testpath 但 执行pytest xx.py却找不到文件,难道是参数配置错了?

testpaths = ./pytest_exercise/test 

看含义,以为是将测试文件路径配置到这个参数,后面就不用指定路径,直接文件名就可以了,其实不是,testpath 只在命令行中没有给出特定的目录,文件或测试 ID,即 执行pytest会会默认搜索 testpath 执行

暫無回覆。
需要 登录 後方可回應,如果你還沒有帳號按這裡 注册