微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

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

走错路的程序员 发布了262 篇原创文章 · 获赞 395 · 访问量 122万+ 他的留言板 关注

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐