vscode 如何调试pytest

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"
            ]*/
        },
        .... //这里还有其它配置不要删掉
        ....
    ]
}

你可能感兴趣的:(python,测试)