VSCode pytest 测试发现失败
·
问题:VSCode pytest 测试发现失败
Pytest 测试发现失败。用户界面指出:
Test discovery error, please check the configuration settings for the tests
输出窗口状态:
Test Discovery failed:
Error: Traceback (most recent call last):
File "C:\Users\mikep\.vscode\extensions\ms-python.python-2019.4.11987\pythonFiles\testing_tools\run_adapter.py", line 16, in <module>
main(tool, cmd, subargs, toolargs)
File "C:\Users\mikep\.vscode\extensions\ms-python.python-2019.4.11987\pythonFiles\testing_tools\adapter\__main__.py", line 90, in main
parents, result = run(toolargs, **subargs)
File "C:\Users\mikep\.vscode\extensions\ms-python.python-2019.4.11987\pythonFiles\testing_tools\adapter\pytest.py", line 43, in discover
raise Exception('pytest discovery failed (exit code {})'.format(ec))
Exception: pytest discovery failed (exit code 3)
这是我的设置:
{
"python.pythonPath": ".venv\\Scripts\\python.exe",
"python.testing.pyTestArgs": [
"tests"
],
"python.testing.unittestEnabled": false,
"python.testing.nosetestsEnabled": false,
"python.testing.pyTestEnabled": true
}
我可以从命令行成功运行 pytest FWIW。
解答
我通过将 pytest 升级到最新版本解决了这个问题:4.4.1 使用“pip install --upgrade pytest”。我显然正在运行旧版本 3.4.2
更多推荐

所有评论(0)