Wing Tips: Conditional Breakpoints Wing Pro's Python Debugger

May 20, 2020


This Wing Tip describes how to use conditional breakpoints in Wing Pro to stop in Python code only when certain conditions are true. This is useful for isolating a single case out of many that may be processed by the same code in a particular run, in order to investigate how that case is being handled.

Conditional breakpoints are also a great way to select the runtime state for which you want to write new Python code, with the ability to immediately try out what you write.

To set a conditional breakpoint, right-click on the breakpoint margin in the editor and select Set Conditional Breakpoint:

Set Conditional Breakpoint

Shown above: Right-click on the breakpoint margin to set a conditional breakpoint.

Then start debug with Start/Continue in the Debug menu, from the toolbar, or as shown here with Debug Tests in the Testing tool:

Debug Unit Tests with a Conditional Breakpoint

Shown above: Select a set of unit tests and debug them to reach the conditional breakpoint, then run to the next hit, step over a few lines, and press Shift-Space to view the value of all visible variables.



That's it for now! We'll be back soon with more Wing Tips for Wing Python IDE.

As always, please don't hesitate to email support@wingware.com if you run into problems or have any questions.



Share this article: