pytest是比较好用的测试框架, 用vscode 调试很方便但是需要配置一下launch.json
在configurations里加上下面的节点.
百度找了半天的中文网页没找到, 后来去http://cn.bing.com/ 国外网站搜到了
原文地址 https://keathmilligan.net/debugging-pytest-in-vscode
{
"version": "0.2.0",
"configurations": [
{
"name": "PyTest",
"type": "python",
"request": "launch",
"stopOnEntry": false,
"pythonPath": "${config:python.pythonPath}",
"module": "pytest",
"args": [
"-sv",
"--disable-pytest-warnings",
"--html=report.html"
],
"cwd": "${workspaceRoot}",
"env": {},
"envFile": "${workspaceRoot}/.env"
/*"debugOptions": [
"WaitOnAbnormalExit",
"WaitOnNormalExit",
"RedirectOutput"
]*/
},
.... //这里还有其它配置不要删掉
....
]
}
走错路的程序员
发布了262 篇原创文章 · 获赞 395 · 访问量 122万+
关注