You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

VSCode更新后debugpy调试超时:手动运行正常但断点失效

VSCode 1.93.0升级后调试Python Behave测试超时(debugpy连接失败)

环境信息

  • macOS系统
  • Python 3.10.0
  • VSCode 1.93.0
  • debugpy扩展版本:ms-python.debugpy-2024.11.2024082901-darwin-arm64

问题概述

升级VSCode到1.93.0版本后,使用launch.json配置调试Python Behave测试时,持续出现Timed out waiting for launcher to connect超时错误。此前调试一切正常,但现在无法通过VSCode调试器设置断点或执行调试流程。

终端直接运行测试、手动通过debugpy启动测试均正常,但VSCode调试器始终无法与debugpy launcher建立连接,手动执行VSCode自带的debugpy launcher文件时出现ConnectionRefusedError: [Errno 61] Connection refused。

我的launch.json配置

{
  // Use IntelliSense to learn about possible attributes.
  // Hover to view descriptions of existing attributes.
  // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
  "version": "0.2.0",
  "configurations": [
    {
      "name": "Jira_id",
      "type": "debugpy",
      "request": "launch",
      "cwd": "${workspaceFolder}/_test/acceptance/src/",
      "module": "behave",
      "env": {
        "PYTHONPATH": "${workspaceFolder}/_test/acceptance/src"
      },
      "console": "integratedTerminal",
      "args": [
        "${file}",
        "-t",
        "@jira.${selectedText}",
        "--no-skipped",
        "-D",
        "TestExecution_environment=local_es"
      ],
      "stopOnEntry": false,
      "justMyCode": false,
      "logToFile": true
    }
  ]
}

可正常运行的命令

终端直接执行behave测试

behave /Users/cxxx/Documents/Development/wallet-core/_test/acceptance/src/features/api/0-component/01-transactions_api/014-operations_b2m/tasks/process_inactive_accounts_kyc/success.feature -t @jira.QAWLLT-44 --no-skipped -D TestExecution_environment=local_es

手动用debugpy启动测试

python -m debugpy --listen 5678 -m behave /Users/cxxx/Documents/Development/wallet-core/_test/acceptance/src/features/api/0-component/01-transactions_api/014-operations_b2m/tasks/process_inactive_accounts_kyc/success.feature -t @jira.QAWLLT-44 --no-skipped -D TestExecution_environment=local_es

错误详情

VSCode调试器报错

Timed out waiting for launcher to connect

手动执行VSCode自带的debugpy launcher时的报错

执行命令:

python /Users/cxxx/.vscode/extensions/ms-python.debugpy-2024.11.2024082901-darwin-arm64/bundled/libs/debugpy/adapter/../../debugpy/launcher 57846 -- -m behave /Users/cxxx/Documents/Development/wallet-core/_test/acceptance/src/features/api/0-component/01-transactions_api/014-operations_b2m/tasks/process_inactive_accounts_kyc/success.feature -t @jira.QAWLLT-44 --no-skipped -D TestExecution_environment=local_es

报错信息:

Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "/Users/cxxx/.vscode/extensions/ms-python.debugpy-2024.11.2024082901-darwin-arm64/bundled/libs/debugpy/adapter/../../debugpy/launcher/__main__.py", line 91, in <module>
    main()
  File "/Users/cxxx/.vscode/extensions/ms-python.debugpy-2024.11.2024082901-darwin-arm64/bundled/libs/debugpy/adapter/../../debugpy/launcher/__main__.py", line 47, in main
    launcher.connect(host, port)
  File "/Users/cxxx/.vscode/extensions/ms-python.debugpy-2024.11.2024082901-darwin-arm64/bundled/libs/debugpy/launcher/../../debugpy/launcher/__init__.py", line 27, in connect
    sock.connect((host, port))
ConnectionRefusedError: [Errno 61] Connection refused

已尝试的排查步骤

  • 更新VSCode和Python扩展至最新版本
  • 仅重装Python相关必要扩展,移除其他扩展
  • 在终端手动测试,确认测试逻辑和参数无问题
  • 确认VSCode已指向正确的Python解释器

请求解决方案

调试对检查测试执行流程和状态至关重要,目前无法通过VSCode调试器进行调试,恳请提供可行的解决方案。

内容的提问来源于stack exchange,提问作者Irene De La Fuente

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.18 12:27:35