我已经在 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)