microsoft / vscode-python-debugger

Python debugger (debugpy) extension for VS Code.
https://marketplace.visualstudio.com/items?itemName=ms-python.debugpy
MIT License
67 stars 25 forks source link

Python debug test unable to step into third party module #498

Open steve148 opened 1 week ago

steve148 commented 1 week ago

Type: Bug

Behaviour

Expected When running a python test in debug mode with justMyCode set to false, I should be able to step into and debug third party modules.

Actual Since v1.92, third party modules are unable to be stepped into with VSCode.

Steps to reproduce:

  1. Clone the demo repo I created at https://github.com/steve148/vscode-test-debug-bug
  2. Install the dependencies with poetry.
  3. Set a break point at the call to the third party module.
  4. Run the test in debug mode.
  5. Try to step into the third party module.

Diagnostic data

launch.json configuration

``` { // 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: Debug Tests", "type": "python", "request": "launch", "program": "${file}", "purpose": [ "debug-test" ], "console": "integratedTerminal", "logToFile": true, "justMyCode": false } ] } ```

Output for Python in the Output panel (ViewOutput, change the drop-down the upper-right of the Output panel to Python)

``` 2024-11-05 22:31:20.287 [warning] Dir "/Users/lennoxstevenson/dev/vscode-test-debug-bug/.pixi/envs" is not watchable (directory does not exist) 2024-11-05 22:31:20.287 [info] VS Code was launched from an activated environment: '.venv', selecting it as the interpreter for workspace. 2024-11-05 22:31:20.287 [info] Python interpreter path: ./.venv/bin/python 2024-11-05 22:31:21.711 [info] > pyenv which python 2024-11-05 22:31:21.711 [info] cwd: . 2024-11-05 22:31:21.735 [info] > conda info --json 2024-11-05 22:31:24.556 [info] Starting Pylance language server. 2024-11-05 22:31:25.671 [info] Discover tests for workspace name: vscode-test-debug-bug - uri: /Users/lennoxstevenson/dev/vscode-test-debug-bug 2024-11-05 22:31:25.683 [info] > . ./.venv/bin/activate && echo 'e8b39361-0157-4923-80e1-22d70d46dee6' && python ~/.vscode/extensions/ms-python.python-2024.18.0-darwin-arm64/python_files/printEnvVariables.py 2024-11-05 22:31:25.683 [info] shell: bash 2024-11-05 22:31:25.716 [info] > ./.venv/bin/python ~/.vscode/extensions/ms-python.python-2024.18.0-darwin-arm64/python_files/testing_tools/run_adapter.py discover pytest -- --rootdir . -s --cache-clear tests 2024-11-05 22:31:25.716 [info] cwd: . 2024-11-05 22:31:30.089 [info] Using configuration in launch.json 2024-11-05 22:31:30.840 [info] CreateEnv Trigger - Skipping for /Users/lennoxstevenson/dev/vscode-test-debug-bug 2024-11-05 22:31:32.684 [info] DAP Server launched with command: /Users/lennoxstevenson/dev/vscode-test-debug-bug/.venv/bin/python /Users/lennoxstevenson/.vscode/extensions/ms-python.debugpy-2024.12.0-darwin-arm64/bundled/libs/debugpy/adapter --log-dir /Users/lennoxstevenson/.vscode/extensions/ms-python.python-2024.18.0-darwin-arm64 2024-11-05 22:31:32.855 [info] Send text to terminal: source /Users/lennoxstevenson/dev/vscode-test-debug-bug/.venv/bin/activate.fish 2024-11-05 22:31:38.576 [info] Using configuration in launch.json 2024-11-05 22:31:38.726 [info] DAP Server launched with command: /Users/lennoxstevenson/dev/vscode-test-debug-bug/.venv/bin/python /Users/lennoxstevenson/.vscode/extensions/ms-python.debugpy-2024.12.0-darwin-arm64/bundled/libs/debugpy/adapter --log-dir /Users/lennoxstevenson/.vscode/extensions/ms-python.python-2024.18.0-darwin-arm64 ```

Output for Python Debugger in the Output panel (ViewOutput, change the drop-down the upper-right of the Output panel to Python Debugger)

``` 2024-11-05 22:31:21.739 [info] Name: Python Debugger 2024-11-05 22:31:21.739 [info] Module: debugpy ```

Extension version: 2024.8.0 VS Code version: Code 1.95.1 (65edc4939843c90c34d61f4ce11704f09d3e5cb6, 2024-10-31T05:14:54.222Z) OS version: Darwin arm64 24.0.0 Modes:

Item Value
CPUs Apple M2 Pro (10 x 2400)
GPU Status 2d_canvas: enabled
canvas_oop_rasterization: enabled_on
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_graphite: disabled_off
video_decode: enabled
video_encode: enabled
webgl: enabled
webgl2: enabled
webgpu: enabled
webnn: disabled_off
Load (avg) 3, 3, 3
Memory (System) 32.00GB (2.91GB free)
Process Argv . --crash-reporter-id ccefdccc-a241-4b18-a2ac-fb744e259231
Screen Reader no
VM 0%

floriandeboissieu commented 4 days ago

I experienced the same problem with vscode 1.95 and actually it seems related to the python version. With python 3.12 I couldn't step into the third party module, while with python 3.11 or python 3.10 it was possible.