-
Notifications
You must be signed in to change notification settings - Fork 146
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Breakpoints not hit in unit tests #392
Comments
Does it break if you use Pause on the debugger toolbar, or the built-in If so, is there anything unusual about the filenames that you see in the editor tabs and in the Call Stack pane when it breaks? |
Sorry, missed the questions. I am able to pause it but only before my local code is run. Here's a screenshot of the call stack pane, which I don't think is unusual but not really sure what to look for. I also figured out it does have something to do with this specific project, on another project I am able to hit by breakpoints. I am using the red circle breakpoints, I am unaware of how to use the built-in EDIT: I have now updated my email settings on this account so I will be notified to an email account I will check. |
@bSolt Here is an example of calling
This assumes you are using Python 3.7 or greater. For older versions of python, you can do this, and it is compatible with all versions of python (including 3.7 or greater).
Note: you don;t have to install debugpy if you are running locally (on the same machine as the python-extension). |
Thanks for the quick tutorial, that's very straightforward. Running this particular project on 3.6.3 so I added import debugpy
debugpy.breakpoint() But it doesn't stop either. How else can I help diagnose this? |
I see. Try this: {
"name": "Python: Test",
"type": "python",
"request": "test",
"console": "integratedTerminal",
"envFile": "${workspaceFolder}/.env",
"justMyCode": false,
"stopOnEntry": false,
"env": {
"DEBUG": "true",
"CF_DIET": "dev"
},
"logToFile": true // <--- this will enable logging.
} You should be able to find logs in the extension folder: |
Also, Share the list of extensions installed. Just do |
List of extensions:
And here are the log files when I tried to run a single unit test with the breakpoint on (test_orchestration.py:48 is where I'm expecting it to stop): EDIT: not sure why python extension shows up twice, but the log files came from the greater versioned one |
Oh that does make sense... Well I'm glad that the "User Uncaught" feature would have alleviated my pain. The issue can probably be closed but I'll leave that up to you. |
@karthiknadig, can you take a look at another instance for me? I'm pretty sure this instance is a bug, because the execution fails a few lines into the test and I have put debug lines on each line of the test I am running, which seem to be ignored. Specifically, the line which pytest is highlighting here is test_flight_rule_check.py:22, which the execution should have been stopped on. The new log files are attached. Should I maybe open a new issue for this? debugpy.pydevd.7820.log |
In this case it seems like I am not about to pause using the toolbar. |
Oh interesting, but when I try to use the inline breakpoint ( |
Another note: once the inline breakpoint is caught, then you can continue as usual to hit subsequent breakpoints invoked via the UI without issue. |
/cc @fabioz |
@bSolt, I'm not exactly sure what's the issue... if you still can reproduce it, can you create a new issue providing some sample code to reproduce as well as the related logs? |
Issue Type: Bug
The python debugger used to work for debugging pytest unit tests, but now will not stop on breakpoints, exceptions, or when using "stopOnEntry"
I have the following entry in my
launch.json
:And these settings:
Extension version: 2020.8.105045
VS Code version: Code 1.48.2 (a0479759d6e9ea56afa657e454193f72aef85bd0, 2020-08-25T10:56:10.074Z)
OS version: Linux x64 3.10.0-1127.13.1.el7.x86_64
System Info
flash_3d: enabled
flash_stage3d: enabled
flash_stage3d_baseline: enabled
gpu_compositing: enabled
multiple_raster_threads: enabled_on
oop_rasterization: disabled_off
protected_video_decode: unavailable_off
rasterization: disabled_software
skia_renderer: disabled_off_ok
video_decode: unavailable_off
viz_display_compositor: enabled_on
viz_hit_test_surface_layer: disabled_off_ok
webgl: enabled
webgl2: enabled
The text was updated successfully, but these errors were encountered: