Search code examples
pythonvisual-studio-codedebuggingvscode-debugger

How can I configure VS Code to break on any unhandled exception in a Python3 application when debugging unittest tests


I am sure this used to work before, and I cannot figure out if there is a setting I changed or anything else.

If I debug a test, and there is an unhandled/uncaught exception, the test stops and I get this screen: enter image description here

How can I get back the behaviour so that the test breaks at the point of the exception?


Solution

  • You have most likely involuntarily unchecked the top boxes in the Breakpoints panel. Check them and things should work as expected again:
    enter image description here

    Most likely when you manually unchecked all the breakpoints.

    Instead, use the little icon in the top right corner, since that one will not uncheck the top three.