参数覆盖错误与Python斜杠测试框架和vscode调试器



我正在尝试使用vscode调试斜杠测试框架测试。

slash run -o perf.ip=1.2.3.4 perftest_perf.py -vvv

我的发射。Json格式如下:

{
"version": "0.2.0",
"configurations": [
{
"name": "slash testing",
"type": "python",
"request": "launch",
"module": "slash.frontend.main",
"args": [
"run",
"-o",
"perf.ip=1.2.3.4",
"-vvv"
],
"console": "integratedTerminal",
"justMyCode": false,
"cwd": "${workspaceFolder}\code\scripts\python"
}
]
}

当我调试文件时,我在终端中得到以下错误:

ERROR: slash.app: Unexpected error occurred
Traceback (most recent call last):
File "C:Python37libsite-packagesslashapp.py", line 119, in __enter__
cli_utils.get_modified_configuration_from_args_context(self.arg_parser, self._parsed_args)
File "C:Python37libcontextlib.py", line 427, in enter_context
result = _cm_type.__enter__(cm)
File "C:Python37libcontextlib.py", line 112, in __enter__
return next(self.gen)
File "C:Python37libsite-packagesslashutilscli_utils.py", line 87, in get_modified_configuration_from_args_context
to_restore.append((path, config.get_path(path)))
File "C:Python37libsite-packagesconfetticonfig.py", line 361, in get_path
return self.get_config(path).get_value()
File "C:Python37libsite-packagesconfetticonfig.py", line 155, in get_config
"Invalid path: {0!r}".format(path))
confetti.exceptions.InvalidPath: Invalid path: 'perf.ip'
ERROR: Unexpected error: Invalid path: 'perf.ip'

这里是否配置错误?在cmd行上运行斜杠命令可以正常工作,但在vscode调试器上出现错误。

已解析。将文件名添加到列表中的run参数之后,就可以正常工作了。似乎通过vscode调试器/启动运行,参数是位置相关的。

{
"version": "0.2.0",
"configurations": [
{
"name": "slash testing",
"type": "python",
"request": "launch",
"module": "slash.frontend.main",
"args": [
"run",
"perf\test_perf.py",
"-o",
"perf.ip=1.2.3.4",
"-vvv"
],
"console": "integratedTerminal",
"justMyCode": false,
"cwd": "${workspaceFolder}\code\scripts\python"
}
]
}