VSCode调试,将文件作为Python模块传递

问题描述 投票:1回答:1

我正在研究Django项目,我使用VSCode作为编辑器。

更重要的是,我发现IDE功能非常有用。所以现在我正在尝试调试之前失败的测试。

在调试配置中,我有以下内容:

{
  "name"    : "Django: TestServer",
  "type"    : "python",
  "request" : "launch",
  "program" : "${workspaceFolder}/manage.py",
  "console" : "integratedTerminal",
  "env"     : {"STAGING_SERVER": "staging.my_server.com"},
  "args"   : ["test", ${file}],
  "django"  : true
}

在启动调试器时,我收到一条消息:

File does not exist "/home/diego/project/manage.py test 
/home/diego/project/func_tests/test_login.py"

当我自己运行测试时,我会这样做:

.../project$ python manage.py test func_tests.test_login

也就是说,将测试地址编写为Python模块而不是文件夹。

我已经阅读了有关Django调试的VSCode文档,但没有找到任何相关内容。有谁知道如何解决这一问题?

谢谢。

python django visual-studio-code django-testing vscode-debugger
1个回答
0
投票

VS Code的Python扩展目前没有对Django测试的支持。你可以跟随Django testing feature request知道何时降落。

© www.soinside.com 2019 - 2024. All rights reserved.