-
Notifications
You must be signed in to change notification settings - Fork 9
Remove vscode-debugger workaround #264
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
Conversation
|
I recommend testing this change in your local setup before merging, just to be safe. I couldn't delete the |
I have experienced this recently, but the code being removed here is not a workaround for that problem. It is to make the debugger stop on exceptions rather than pytest just swallowing them and this has existed for a while before I started seeing this behaviour. Are you sure these things are related? |
|
I'm fairly confident these issues are related—if you take a look at this Stack Overflow answer, it uses exactly the same approach as in the copier template. The comment there also references pytest issue #7409, which in turn depends on debugpy issue #275. Both of these have since been resolved, so simply updating the Python extension in VS Code should address the underlying problem. Have you had a chance to try removing this workaround and testing it with the latest debugger? |
|
I have tested this on I checked in I have tested this in |
|
OK I think I see what you mean. If an exception is raised in a test then it is caught, but it also runs all of the other tests for some reason. It did not do this when this was first added. If I take out the pytest hooks then it doesn't run all of the other tests, but it also doesn't stop on the exception. It seems like enabling "User uncaught exceptions" in vscode gives the same behaviour without needing to add the pytest hooks - is that right? |
Yes, this was broken recently.
Yes..This is correct ...If "User uncaught exceptions" enabled by default is a requirement I can try using some workaround in conftest...but I think it will be quite hacky and might break quite often |
|
That's fine - it doesn't need to be on by default, that doesn't seem like it would be possible. This is more something that should go in the developer guide. |
closes #262
The issue where running a single test in the VSCode debugger would trigger other tests was due to a known bug in pytest (pytest issue #7409).
This workaround is no longer necessary because VSCode's Python debugger (vscode-python-debugger) depends on debugpy, where the root cause was fixed in commit 1 and commit 2, as referenced in debugpy issue #275.
Therefore, the workaround can be safely removed. Simply ensure you're using the latest version of the VSCode Python Debugger currently (
2025.8.0).More info on the extension: VSCode Python Debugger