Skip to content

Commit

Permalink
tests
Browse files Browse the repository at this point in the history
  • Loading branch information
stevetracvc committed Sep 27, 2022
1 parent 9883df9 commit 8e78388
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions spyder/app/tests/test_mainwindow.py
Original file line number Diff line number Diff line change
Expand Up @@ -3899,6 +3899,39 @@ def test_post_mortem(main_window, qtbot, tmpdir):
assert "IPdb [" in control.toPlainText()


# @pytest.mark.slow
@flaky(max_runs=3)
@pytest.mark.parametrize("post_mortem", [True, False])
def test_post_mortem_run_cell(main_window, qtbot, tmpdir, post_mortem):
"""Test post mortem works"""
# Check we can use custom complete for pdb
shell = main_window.ipyconsole.get_current_shellwidget()
qtbot.waitUntil(lambda: shell._prompt_html is not None,
timeout=SHELL_TIMEOUT)
control = main_window.ipyconsole.get_widget().get_focus_widget()

test_file = tmpdir.join('test.py')
test_file.write('raise RuntimeError\n')

# Load code in the editor
main_window.editor.load(to_text_string(test_file))

CONF.set('run', 'post_mortem', post_mortem)

# Wait for the console to be up
shell = main_window.ipyconsole.get_current_shellwidget()
qtbot.waitUntil(lambda: shell._prompt_html is not None,
timeout=SHELL_TIMEOUT)

# Run a cell
with qtbot.waitSignal(shell.executed):
run_cell_action = main_window.run_toolbar_actions[1]
run_cell_button = main_window.run_toolbar.widgetForAction(run_cell_action)
qtbot.mouseClick(run_cell_button, Qt.LeftButton)

assert ("IPdb [" in control.toPlainText()) is post_mortem


@pytest.mark.slow
@flaky(max_runs=3)
def test_run_unsaved_file_multiprocessing(main_window, qtbot):
Expand Down

0 comments on commit 8e78388

Please sign in to comment.