本文整理汇总了Python中mu.modes.debugger.DebugMode.finished方法的典型用法代码示例。如果您正苦于以下问题:Python DebugMode.finished方法的具体用法?Python DebugMode.finished怎么用?Python DebugMode.finished使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mu.modes.debugger.DebugMode
的用法示例。
在下文中一共展示了DebugMode.finished方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_debug_finished
# 需要导入模块: from mu.modes.debugger import DebugMode [as 别名]
# 或者: from mu.modes.debugger.DebugMode import finished [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)
示例2: test_debug_on_finished
# 需要导入模块: from mu.modes.debugger import DebugMode [as 别名]
# 或者: from mu.modes.debugger.DebugMode import finished [as 别名]
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()
示例3: test_debug_on_fail
# 需要导入模块: from mu.modes.debugger import DebugMode [as 别名]
# 或者: from mu.modes.debugger.DebugMode import finished [as 别名]
def test_debug_on_fail():
"""
Ensure an appropriate message is shown to the user and the UI is put into
the correct state if the debug client calls this function because it can't
connect to the runner.
"""
editor = mock.MagicMock()
view = mock.MagicMock()
dm = DebugMode(editor, view)
dm.finished = mock.MagicMock()
dm.debug_on_fail('This is a useful message')
assert view.process_runner.append.call_count == 1 # message shown.
dm.finished.assert_called_once_with()
view.process_runner.finished.assert_called_once_with(1, -1)