当前位置: 首页>>代码示例>>Python>>正文


Python DebugMode.debugger方法代码示例

本文整理汇总了Python中mu.modes.debugger.DebugMode.debugger方法的典型用法代码示例。如果您正苦于以下问题:Python DebugMode.debugger方法的具体用法?Python DebugMode.debugger怎么用?Python DebugMode.debugger使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在mu.modes.debugger.DebugMode的用法示例。


在下文中一共展示了DebugMode.debugger方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_debug_on_line_ignore_file

# 需要导入模块: from mu.modes.debugger import DebugMode [as 别名]
# 或者: from mu.modes.debugger.DebugMode import debugger [as 别名]
def test_debug_on_line_ignore_file():
    """
    If the filename is in the ignored bucket, do a return.
    """
    editor = mock.MagicMock()
    view = mock.MagicMock()
    dm = DebugMode(editor, view)
    dm.debugger = mock.MagicMock()
    dm.debug_on_line('bdb.py', 100)
    dm.debugger.do_return.assert_called_once_with()
开发者ID:ZanderBrown,项目名称:mu,代码行数:12,代码来源:test_debug.py

示例2: test_debug_on_return

# 需要导入模块: from mu.modes.debugger import DebugMode [as 别名]
# 或者: from mu.modes.debugger.DebugMode import debugger [as 别名]
def test_debug_on_return():
    """
    Returning from a function causes the debugger to step out of the function.
    """
    editor = mock.MagicMock()
    view = mock.MagicMock()
    dm = DebugMode(editor, view)
    dm.debugger = mock.MagicMock()
    dm.debug_on_return(None)
    dm.debugger.do_step.assert_called_once_with()
开发者ID:ZanderBrown,项目名称:mu,代码行数:12,代码来源:test_debug.py

示例3: test_debug_on_call

# 需要导入模块: from mu.modes.debugger import DebugMode [as 别名]
# 或者: from mu.modes.debugger.DebugMode import debugger [as 别名]
def test_debug_on_call():
    """
    Calling a function causes the debugger to step into the function.
    """
    editor = mock.MagicMock()
    view = mock.MagicMock()
    dm = DebugMode(editor, view)
    dm.debugger = mock.MagicMock()
    dm.debug_on_call(None)
    dm.debugger.do_step.assert_called_once_with()
开发者ID:ZanderBrown,项目名称:mu,代码行数:12,代码来源:test_debug.py

示例4: test_debug_button_step_out

# 需要导入模块: from mu.modes.debugger import DebugMode [as 别名]
# 或者: from mu.modes.debugger.DebugMode import debugger [as 别名]
def test_debug_button_step_out():
    """
    Ensure the do_return method is called when the step-out button is clicked.
    """
    editor = mock.MagicMock()
    view = mock.MagicMock()
    dm = DebugMode(editor, view)
    dm.debugger = mock.MagicMock()
    dm.button_step_out(None)
    dm.debugger.do_return.assert_called_once_with()
开发者ID:willingc,项目名称:mu,代码行数:12,代码来源:test_debug.py

示例5: test_debug_button_continue

# 需要导入模块: from mu.modes.debugger import DebugMode [as 别名]
# 或者: from mu.modes.debugger.DebugMode import debugger [as 别名]
def test_debug_button_continue():
    """
    Ensure the do_run method is called when the continue button is clicked.
    """
    editor = mock.MagicMock()
    view = mock.MagicMock()
    dm = DebugMode(editor, view)
    dm.debugger = mock.MagicMock()
    dm.button_continue(None)
    dm.debugger.do_run.assert_called_once_with()
开发者ID:willingc,项目名称:mu,代码行数:12,代码来源:test_debug.py

示例6: test_debug_button_step_in

# 需要导入模块: from mu.modes.debugger import DebugMode [as 别名]
# 或者: from mu.modes.debugger.DebugMode import debugger [as 别名]
def test_debug_button_step_in():
    """
    Ensure the do_step method is called when the step-in button is clicked.
    """
    editor = mock.MagicMock()
    view = mock.MagicMock()
    dm = DebugMode(editor, view)
    dm.debugger = mock.MagicMock()
    dm.button_step_in(None)
    dm.debugger.do_step.assert_called_once_with()
    assert view.current_tab.reset_debugger_highlight.call_count == 1
开发者ID:ZanderBrown,项目名称:mu,代码行数:13,代码来源:test_debug.py

示例7: test_debug_on_exception

# 需要导入模块: from mu.modes.debugger import DebugMode [as 别名]
# 或者: from mu.modes.debugger.DebugMode import debugger [as 别名]
def test_debug_on_exception():
    """
    Since an exception has been signalled, allow the script to run to the
    end of life so the error is correctly reported via stdout.
    """
    editor = mock.MagicMock()
    view = mock.MagicMock()
    dm = DebugMode(editor, view)
    dm.debugger = mock.MagicMock()
    dm.debug_on_exception("Exception", "Exception information")
    dm.debugger.do_run.assert_called_once_with()
    assert view.current_tab.reset_debugger_highlight.call_count == 1
开发者ID:ZanderBrown,项目名称:mu,代码行数:14,代码来源:test_debug.py

示例8: test_debug_on_bootstrap

# 需要导入模块: from mu.modes.debugger import DebugMode [as 别名]
# 或者: from mu.modes.debugger.DebugMode import debugger [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()
开发者ID:willingc,项目名称:mu,代码行数:17,代码来源:test_debug.py

示例9: test_debug_toggle_breakpoint_on_existing

# 需要导入模块: from mu.modes.debugger import DebugMode [as 别名]
# 或者: from mu.modes.debugger.DebugMode import debugger [as 别名]
def test_debug_toggle_breakpoint_on_existing():
    """
    If the breakpoint doesn't exist, create it.
    """
    editor = mock.MagicMock()
    view = mock.MagicMock()
    dm = DebugMode(editor, view)
    mock_debugger = mock.MagicMock()
    dm.debugger = mock_debugger
    mock_debugger.breakpoints.return_value = {}
    mock_tab = mock.MagicMock()
    mock_tab.path = 'foo'
    mock_tab.markersAtLine.return_value = False
    dm.toggle_breakpoint(0, mock_tab)
    dm.debugger.create_breakpoint.assert_called_once_with(mock_tab.path, 1)
开发者ID:ZanderBrown,项目名称:mu,代码行数:17,代码来源:test_debug.py

示例10: test_debug_finished

# 需要导入模块: from mu.modes.debugger import DebugMode [as 别名]
# 或者: from mu.modes.debugger.DebugMode import debugger [as 别名]
def test_debug_finished():
    """
    Ensure the end-state of the mode is enacted when the running script has
    finished executing.
    """
    editor = mock.MagicMock()
    view = mock.MagicMock()
    view.button_bar.slots = {
        'stop': mock.MagicMock(),
        'run': mock.MagicMock(),
        'step-over': mock.MagicMock(),
        'step-in': mock.MagicMock(),
        'step-out': mock.MagicMock(),
    }
    dm = DebugMode(editor, view)
    mock_debugger = mock.MagicMock()
    dm.debugger = mock_debugger
    mock_debugger.bp_index = []
    mock_breakpoint = mock.MagicMock()
    mock_breakpoint.enabled = True
    mock_debugger.breakpoints.side_effect = [
        {
            1: mock_breakpoint,
        },
        {},
    ]
    tab1 = mock.MagicMock()
    tab1.path = 'foo'
    tab2 = mock.MagicMock()
    view.widgets = [tab1, tab2]
    dm.finished()
    # Buttons are set to the right state.
    assert view.button_bar.slots['stop'].setEnabled.call_count == 0
    view.button_bar.slots['run'].setEnabled.assert_called_once_with(False)
    view.button_bar.slots['step-over'].\
        setEnabled.assert_called_once_with(False)
    view.button_bar.slots['step-in'].setEnabled.assert_called_once_with(False)
    view.button_bar.slots['step-out'].setEnabled.assert_called_once_with(False)
    # Tabs are set to the right state.
    tab1.markerDeleteAll.assert_called_once_with()
    tab1.breakpoint_lines == set([1, ])
    tab1.setSelection.assert_called_once_with(0, 0, 0, 0)
    tab1.markerAdd(0, tab1.BREAKPOINT_MARKER)
    tab2.markerDeleteAll.assert_called_once_with()
    tab2.breakpoint_lines == set()
    tab2.setSelection.assert_called_once_with(0, 0, 0, 0)
开发者ID:willingc,项目名称:mu,代码行数:48,代码来源:test_debug.py

示例11: test_debug_on_bootstrap_remove_missing_marker_handles

# 需要导入模块: from mu.modes.debugger import DebugMode [as 别名]
# 或者: from mu.modes.debugger.DebugMode import debugger [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
开发者ID:ZanderBrown,项目名称:mu,代码行数:19,代码来源:test_debug.py

示例12: test_debug_on_bootstrap

# 需要导入模块: from mu.modes.debugger import DebugMode [as 别名]
# 或者: from mu.modes.debugger.DebugMode import debugger [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()
开发者ID:ZanderBrown,项目名称:mu,代码行数:19,代码来源:test_debug.py

示例13: test_debug_on_bootstrap_ignore_duplicate_handles

# 需要导入模块: from mu.modes.debugger import DebugMode [as 别名]
# 或者: from mu.modes.debugger.DebugMode import debugger [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
开发者ID:ZanderBrown,项目名称:mu,代码行数:20,代码来源:test_debug.py

示例14: test_debug_toggle_breakpoint_on_new

# 需要导入模块: from mu.modes.debugger import DebugMode [as 别名]
# 或者: from mu.modes.debugger.DebugMode import debugger [as 别名]
def test_debug_toggle_breakpoint_on_new():
    """
    If the breakpoint is off but disabled, enable it.
    """
    editor = mock.MagicMock()
    view = mock.MagicMock()
    dm = DebugMode(editor, view)
    mock_debugger = mock.MagicMock()
    dm.debugger = mock_debugger
    mock_breakpoint = mock.MagicMock()
    mock_debugger.breakpoints.side_effect = [
        {
            1: mock_breakpoint,
        },
    ]
    mock_tab = mock.MagicMock()
    mock_tab.path = 'foo'
    mock_tab.markersAtLine.return_value = False
    dm.toggle_breakpoint(0, mock_tab)
    dm.debugger.enable_breakpoint.assert_called_once_with(mock_breakpoint)
开发者ID:ZanderBrown,项目名称:mu,代码行数:22,代码来源:test_debug.py

示例15: test_debug_on_bootstrap_remove_invalid_breaks

# 需要导入模块: from mu.modes.debugger import DebugMode [as 别名]
# 或者: from mu.modes.debugger.DebugMode import debugger [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)
开发者ID:ZanderBrown,项目名称:mu,代码行数:23,代码来源:test_debug.py


注:本文中的mu.modes.debugger.DebugMode.debugger方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。