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


Python debugger.DebugMode类代码示例

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


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

示例1: test_debug_on_stack

def test_debug_on_stack():
    """
    Ensure the expected locals dict is passed to the view so the object
    inspector is updated properly.
    """
    editor = mock.MagicMock()
    view = mock.MagicMock()
    dm = DebugMode(editor, view)
    stack = [
        (
            1,
            {
                'locals': {
                    'a': 'frame1',
                    'b': 'frame1',
                }
            }
        ),
        (
            2,
            {
                'locals': {
                    'b': 'frame2',
                    'c': 'frame2',
                }
            }
        )
    ]
    dm.debug_on_stack(stack)
    view.update_debug_inspector.assert_called_once_with({
        'a': 'frame1',
        'b': 'frame2',
        'c': 'frame2',
    })
开发者ID:ZanderBrown,项目名称:mu,代码行数:34,代码来源:test_debug.py

示例2: test_debug_start

def test_debug_start():
    """
    Ensure the handling of starting the debugger works as expected.
    """
    editor = mock.MagicMock()
    editor.envars = [['name', 'value'], ]
    view = mock.MagicMock()
    view.current_tab.path = '/foo'
    view.current_tab.isModified.return_value = True
    mock_runner = mock.MagicMock()
    view.add_python3_runner.return_value = mock_runner
    mock_debugger = mock.MagicMock()
    mock_debugger_class = mock.MagicMock(return_value=mock_debugger)
    dm = DebugMode(editor, view)
    dm.workspace_dir = mock.MagicMock(return_value='/bar')
    with mock.patch('builtins.open') as oa, \
            mock.patch('mu.modes.debugger.Debugger', mock_debugger_class), \
            mock.patch('mu.modes.debugger.write_and_flush'):
        dm.start()
        oa.assert_called_once_with('/foo', 'w', newline='')
    view.add_python3_runner.assert_called_once_with('/foo', '/bar',
                                                    debugger=True,
                                                    envars=[['name', 'value']])
    mock_runner.process.waitForStarted.assert_called_once_with()
    mock_runner.process.finished.connect.assert_called_once_with(dm.finished)
    view.add_debug_inspector.assert_called_once_with()
    view.set_read_only.assert_called_once_with(True)
    mock_debugger_class.assert_called_once_with('localhost', DEBUGGER_PORT,
                                                proc=mock_runner.process)
    assert dm.runner == mock_runner
    assert dm.debugger == mock_debugger
    assert mock_debugger.view == dm
    mock_debugger.start.assert_called_once_with()
开发者ID:ZanderBrown,项目名称:mu,代码行数:33,代码来源:test_debug.py

示例3: test_debug_mode

def test_debug_mode():
    """
    Sanity check for setting up of the mode.
    """
    editor = mock.MagicMock()
    view = mock.MagicMock()
    dm = DebugMode(editor, view)
    assert dm.name == 'Graphical Debugger'
    assert dm.description is not None
    assert dm.icon == 'python'
    assert dm.runner is None
    assert dm.is_debugger is True
    assert dm.editor == editor
    assert dm.view == view

    assert dm.api() == []

    actions = dm.actions()
    assert len(actions) == 5
    assert actions[0]['name'] == 'stop'
    assert actions[0]['handler'] == dm.button_stop
    assert actions[1]['name'] == 'run'
    assert actions[1]['handler'] == dm.button_continue
    assert actions[2]['name'] == 'step-over'
    assert actions[2]['handler'] == dm.button_step_over
    assert actions[3]['name'] == 'step-in'
    assert actions[3]['handler'] == dm.button_step_in
    assert actions[4]['name'] == 'step-out'
    assert actions[4]['handler'] == dm.button_step_out
开发者ID:ZanderBrown,项目名称:mu,代码行数:29,代码来源:test_debug.py

示例4: test_debug_on_breakpoint_clear

def test_debug_on_breakpoint_clear():
    """
    Should do nothing.
    """
    editor = mock.MagicMock()
    view = mock.MagicMock()
    dm = DebugMode(editor, view)
    assert dm.debug_on_breakpoint_clear(None) is None
开发者ID:ZanderBrown,项目名称:mu,代码行数:8,代码来源:test_debug.py

示例5: test_debug_on_exception

def test_debug_on_exception():
    """
    Should do nothing.
    """
    editor = mock.MagicMock()
    view = mock.MagicMock()
    dm = DebugMode(editor, view)
    assert dm.debug_on_exception(None, None) is None
开发者ID:willingc,项目名称:mu,代码行数:8,代码来源:test_debug.py

示例6: test_debug_on_restart

def test_debug_on_restart():
    """
    Should do nothing.
    """
    editor = mock.MagicMock()
    view = mock.MagicMock()
    dm = DebugMode(editor, view)
    assert dm.debug_on_restart() is None
开发者ID:ZanderBrown,项目名称:mu,代码行数:8,代码来源:test_debug.py

示例7: test_debug_button_stop

def test_debug_button_stop():
    """
    Ensure the stop method is called when the stop button is clicked.
    """
    editor = mock.MagicMock()
    view = mock.MagicMock()
    dm = DebugMode(editor, view)
    dm.stop = mock.MagicMock()
    dm.button_stop(None)
    dm.stop.assert_called_once_with()
开发者ID:ZanderBrown,项目名称:mu,代码行数:10,代码来源:test_debug.py

示例8: test_debug_button_step_out

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,代码行数:10,代码来源:test_debug.py

示例9: test_debug_on_line_ignore_file

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,代码行数:10,代码来源:test_debug.py

示例10: test_debug_on_error

def test_debug_on_error():
    """
    Error messages result in a status message being shown by the editor.
    """
    editor = mock.MagicMock()
    view = mock.MagicMock()
    dm = DebugMode(editor, view)
    dm.debug_on_error('message')
    expected = 'Debugger error: message'
    editor.show_status_message.assert_called_once_with(expected)
开发者ID:ZanderBrown,项目名称:mu,代码行数:10,代码来源:test_debug.py

示例11: test_debug_on_call

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,代码行数:10,代码来源:test_debug.py

示例12: test_debug_on_return

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,代码行数:10,代码来源:test_debug.py

示例13: test_debug_on_finished

def test_debug_on_finished():
    """
    When the debugger is finished, the view is reset.
    """
    editor = mock.MagicMock()
    view = mock.MagicMock()
    dm = DebugMode(editor, view)
    dm.finished = mock.MagicMock()
    dm.debug_on_finished()
    dm.finished.assert_called_once_with()
开发者ID:ZanderBrown,项目名称:mu,代码行数:10,代码来源:test_debug.py

示例14: test_debug_button_continue

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,代码行数:10,代码来源:test_debug.py

示例15: test_debug_start_no_tab

def test_debug_start_no_tab():
    """
    If there's no active tab, there can be no runner either.
    """
    editor = mock.MagicMock()
    view = mock.MagicMock()
    view.current_tab = None
    dm = DebugMode(editor, view)
    dm.start()
    assert dm.runner is None
开发者ID:ZanderBrown,项目名称:mu,代码行数:10,代码来源:test_debug.py


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