小编Uri*_*Uri的帖子

如何将命令行参数传递给在 vscode 中运行的 pytest 测试

我已经在 vscode 项目中编写了由 pytest 运行的测试。配置文件 .vscode/settings.json 允许使用以下命令将其他命令行参数传递给 pytest:

    "python.testing.pytestArgs": [
        "test/",
        "--exitfirst",
        "--verbose"
    ],
Run Code Online (Sandbox Code Playgroud)

我怎样才能将自定义脚本参数传递给测试脚本本身?就像从命令行调用 pytest 一样:

pytest --exitfirst --verbose test/ --test_arg1  --test_arg2
Run Code Online (Sandbox Code Playgroud)

python unit-testing pytest visual-studio-code

7
推荐指数
1
解决办法
4892
查看次数

标签 统计

pytest ×1

python ×1

unit-testing ×1

visual-studio-code ×1