Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_load_breakpoints(mocker):
fake_data = ['b /home/user/test.py:41'], ['b /home/user/test.py:50']
mock_open = mocker.mock_open()
mock_open.return_value.readlines.side_effect = fake_data
mocker.patch.object(builtins, 'open', mock_open)
mocker.patch('pudb.settings.lookup_module',
mocker.Mock(return_value='/home/user/test.py'))
mocker.patch('pudb.settings.get_breakpoint_invalid_reason',
mocker.Mock(return_value=None))
result = load_breakpoints()
expected = [('/home/user/test.py', 41, False, None, None),
('/home/user/test.py', 50, False, None, None)]
assert result == expected
def reload_breakpoints(w, size, key):
self.debugger.clear_all_breaks()
from pudb.settings import load_breakpoints
for bpoint_descr in load_breakpoints():
dbg.set_break(*bpoint_descr)
self.update_breakpoints()
def iter_breakpoints(self, buffname=None):
"""iter_breakpoints
iterates over the breakpoints registered with pudb for this buffer
"""
for brpt in pudb.settings.load_breakpoints():
if not buffname:
yield self.pudbbp(*brpt[:2])
elif buffname == brpt[0]:
yield self.pudbbp(*brpt[:2])