def test_calltip(main_window, qtbot): """Hide the calltip in the editor when a matching ')' is found.""" # Load test file text = 'a = [1,2,3]\n(max' main_window.editor.new(fname="test.py", text=text) code_editor = main_window.editor.get_focus_widget() # Set text to start code_editor.set_text(text) code_editor.go_to_line(2) code_editor.move_cursor(5) calltip = code_editor.calltip_widget assert not calltip.isVisible() qtbot.keyPress(code_editor, Qt.Key_ParenLeft, delay=3000) qtbot.keyPress(code_editor, Qt.Key_A, delay=1000) qtbot.waitUntil(lambda: calltip.isVisible(), timeout=1000) qtbot.keyPress(code_editor, Qt.Key_ParenRight, delay=1000) qtbot.keyPress(code_editor, Qt.Key_Space) assert not calltip.isVisible() qtbot.keyPress(code_editor, Qt.Key_ParenRight, delay=1000) qtbot.keyPress(code_editor, Qt.Key_Enter, delay=1000) QTimer.singleShot(1000, lambda: close_save_message_box(qtbot)) main_window.editor.close_file()
def test_close_when_file_is_changed(main_window, qtbot): """Test closing spyder when there is a file with modifications open.""" # Wait until the window is fully up shell = main_window.ipyconsole.get_current_shellwidget() qtbot.waitUntil(lambda: shell._prompt_html is not None, timeout=SHELL_TIMEOUT) # Load test file test_file = osp.join(LOCATION, 'script.py') main_window.editor.load(test_file) editorstack = main_window.editor.get_current_editorstack() editor = editorstack.get_current_editor() editor.document().setModified(True) # Close.main-window QTimer.singleShot(1000, lambda: close_save_message_box(qtbot)) main_window.close() # Wait for the segfault qtbot.wait(3000)