主页

索引

模块索引

搜索页面

2.7.5. 调试功能

launch.json

示例:

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Python Debugger: Module",
            "type": "debugpy",
            "request": "launch",
            "module": "metagpt.software_company"
        },

        # 单元测试:指定模块
        # 相当于: pytest -s -v metagpt/test_environment.py::test_publish_and_process_message
        {
            "name": "Pytest: special module",
            "type": "debugpy",
            "request": "launch",
            "module": "pytest",
            "args": [
                "-s",
                "-v",
                "tests/metagpt/test_environment.py::test_publish_and_process_message"
            ],
            "console": "integratedTerminal",
            "cwd": "${workspaceFolder}"
        },
        {
            "name": "Pytest: special file",
            "type": "debugpy",
            "request": "launch",
            "module": "pytest",
            "args": [
                "-s",
                "-v",
                "${file}"
            ],
            "console": "integratedTerminal",
            "cwd": "${workspaceFolder}"
        }
    ]
}

另一个示例:

{
    "name": "Python Debugger: system_command->run",
    "type": "debugpy",
    "request": "launch",
    "module": "run",
    "cwd": "${workspaceFolder}/system_command",
    "env": {
        "PYTHONPATH": "${workspaceFolder}/system_command"
    },
    "jinja": true,
    "justMyCode": false,
    "console": "integratedTerminal",
    "logToFile": true,
    "logFile": "${workspaceFolder}/.vscode/logs/debug.log",
}

VSCode 的命令面板

主页

索引

模块索引

搜索页面