小编kat*_*tch的帖子

如何使用环境变量为pytest配置VS代码

我正在尝试调试 pytest。我想注入一个环境变量。这是我设置 launch.json 的方法

{
    "type": "python",
    "request": "test",
    "name": "pytest",
    "console": "integratedTerminal",
    "env": {
        "ENV_VAR":"RandomStuff"
    }
},
Run Code Online (Sandbox Code Playgroud)

但当我开始调试时似乎。我没有看到注入的 env 变量,因此我的测试预计 env 变量失败。

我还注意到错误

Could not load unit test config from launch.json
Run Code Online (Sandbox Code Playgroud)

visual-studio-code vscode-debugger

25
推荐指数
3
解决办法
3万
查看次数