本文整理汇总了Python中mu.modes.debugger.DebugMode.debug_on_bootstrap方法的典型用法代码示例。如果您正苦于以下问题:Python DebugMode.debug_on_bootstrap方法的具体用法?Python DebugMode.debug_on_bootstrap怎么用?Python DebugMode.debug_on_bootstrap使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mu.modes.debugger.DebugMode
的用法示例。
在下文中一共展示了DebugMode.debug_on_bootstrap方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_debug_on_bootstrap
# 需要导入模块: from mu.modes.debugger import DebugMode [as 别名]
# 或者: from mu.modes.debugger.DebugMode import debug_on_bootstrap [as 别名]
def test_debug_on_bootstrap():
"""
Ensure all the current breakpoints are set and the script is run.
"""
editor = mock.MagicMock()
view = mock.MagicMock()
dm = DebugMode(editor, view)
dm.debugger = mock.MagicMock()
mock_tab = mock.MagicMock()
mock_tab.path = 'foo'
mock_tab.breakpoint_lines = set([0, ])
view.widgets = [mock_tab, ]
dm.debug_on_bootstrap()
dm.debugger.create_breakpoint.assert_called_once_with(mock_tab.path, 1)
dm.debugger.do_run.assert_called_once_with()
示例2: test_debug_on_bootstrap_remove_missing_marker_handles
# 需要导入模块: from mu.modes.debugger import DebugMode [as 别名]
# 或者: from mu.modes.debugger.DebugMode import debug_on_bootstrap [as 别名]
def test_debug_on_bootstrap_remove_missing_marker_handles():
"""
Ensure all marker handles that are not currently associated with a line
are removed from the breakpoint_handles set.
"""
editor = mock.MagicMock()
view = mock.MagicMock()
dm = DebugMode(editor, view)
dm.debugger = mock.MagicMock()
mock_tab = mock.MagicMock()
mock_tab.path = 'foo'
mock_tab.breakpoint_handles = set([0, ])
mock_tab.markerLine.return_value = -1
view.widgets = [mock_tab, ]
dm.debug_on_bootstrap()
assert dm.debugger.create_breakpoint.call_count == 0
assert 0 not in mock_tab.breakpoint_handles
示例3: test_debug_on_bootstrap
# 需要导入模块: from mu.modes.debugger import DebugMode [as 别名]
# 或者: from mu.modes.debugger.DebugMode import debug_on_bootstrap [as 别名]
def test_debug_on_bootstrap():
"""
Ensure all the current breakpoints are set and the script is run.
"""
editor = mock.MagicMock()
view = mock.MagicMock()
dm = DebugMode(editor, view)
dm.debugger = mock.MagicMock()
mock_tab = mock.MagicMock()
mock_tab.path = 'foo'
mock_tab.text.return_value = "print('Hello')"
mock_tab.breakpoint_handles = set([0, ])
mock_tab.markerLine.return_value = 0
view.widgets = [mock_tab, ]
dm.debug_on_bootstrap()
dm.debugger.create_breakpoint.assert_called_once_with(mock_tab.path, 1)
dm.debugger.do_run.assert_called_once_with()
示例4: test_debug_on_bootstrap_ignore_duplicate_handles
# 需要导入模块: from mu.modes.debugger import DebugMode [as 别名]
# 或者: from mu.modes.debugger.DebugMode import debug_on_bootstrap [as 别名]
def test_debug_on_bootstrap_ignore_duplicate_handles():
"""
Sometimes it's possible for two different handles to be found on a single
line due to how Scintilla moves markers around as lines are concatenated.
This ensures only one breakpoint is created per marker.
"""
editor = mock.MagicMock()
view = mock.MagicMock()
dm = DebugMode(editor, view)
dm.debugger = mock.MagicMock()
mock_tab = mock.MagicMock()
mock_tab.path = 'foo'
mock_tab.text.return_value = "print('Hello')"
mock_tab.breakpoint_handles = set([0, 1])
mock_tab.markerLine.side_effect = [1, 1]
view.widgets = [mock_tab, ]
dm.debug_on_bootstrap()
assert dm.debugger.create_breakpoint.call_count == 1
示例5: test_debug_on_bootstrap_remove_invalid_breaks
# 需要导入模块: from mu.modes.debugger import DebugMode [as 别名]
# 或者: from mu.modes.debugger.DebugMode import debug_on_bootstrap [as 别名]
def test_debug_on_bootstrap_remove_invalid_breaks():
"""
Sometimes it's possible for a marker to end up on a line that is eventually
an in-valid breakpoint line. This checks that such markers don't end up
with an attempt to set a breakpoint and are ultimately discarded so the
visual state of the markers matches the breakpoint state of the debugger.
"""
editor = mock.MagicMock()
view = mock.MagicMock()
dm = DebugMode(editor, view)
dm.debugger = mock.MagicMock()
mock_tab = mock.MagicMock()
mock_tab.path = 'foo'
mock_tab.breakpoint_handles = set([0, ])
mock_tab.markerLine.return_value = 1
view.widgets = [mock_tab, ]
with mock.patch('mu.modes.debugger.is_breakpoint_line',
return_value=False):
dm.debug_on_bootstrap()
assert 0 not in mock_tab.breakpoint_handles
mock_tab.markerDelete.assert_called_once_with(1, -1)