启动调试器时site-packages代码断点失效的问题排查
调试pytest单元测试无法步入库函数的问题
环境信息
- MacOS Monterey
- Python 3.9.13
- VS Code 1.76.2
- pytest==7.2.0
- 使用virtualenv虚拟环境
问题详情
调试单元测试时,尝试步入库函数却无法进入,程序直接运行完成;手动在库代码中设置断点也没有效果。
我已经在launch.json中设置justMyCode为false,配置内容如下:
{ // 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": "Python: Current File", "type": "python", "request": "launch", "program": "${file}", "console": "integratedTerminal", "justMyCode": false } ] }
参考相关方案后,我尝试将site-packages目录添加到工作区,但没有任何变化。
初始状态下,库代码中的断点可以正常显示(标记为已设置状态),但一旦执行“Debug test”操作,这些库代码里的断点就会被自动禁用。
内容的提问来源于stack exchange,提问作者Roy Smith
相关产品推荐
相关产品推荐

