Problem
When using Scenario for unit tests, calling breakpoint() in charm code does nothing. It only works in test code or when using import pdb; pdb.set_trace() directly.
Root Cause
The ops Framework overrides sys.breakpointhook with a custom implementation that only activates when JUJU_DEBUG_AT environment variable is set. During unit tests, this variable isn't set, so breakpoint() silently returns without doing anything.
Reproduction
- Add
breakpoint() to a charm event handler
- Write a scenario test that invokes that handler
- Run
pytest
- Breakpoint is never triggered