Skip to content

Commit

Permalink
Adds a test.
Browse files Browse the repository at this point in the history
  • Loading branch information
dalthviz committed Mar 21, 2017
1 parent 977448f commit 8f8cd5c
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 1 deletion.
2 changes: 2 additions & 0 deletions spyder/app/tests/edit_calltip.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
a = [1,2,3]
(max(a) )
35 changes: 34 additions & 1 deletion spyder/app/tests/test_mainwindow.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

from spyder.app.cli_options import get_options
from spyder.app.mainwindow import initialize, run_spyder

from spyder.utils.tests import close_message_box

#==============================================================================
# Constants
Expand Down Expand Up @@ -81,6 +81,39 @@ def close_widget():
#==============================================================================
# Tests
#==============================================================================
@flaky(max_runs=10)
@pytest.mark.skipif(os.name != 'nt',
reason="The mainwindow stays open: "
"makes a segfault in PYQT5 and "
"a error in the count of the editorStack in PYQT4.")#FIXME Probably caused by the save message of the file
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'
test_file = osp.join(LOCATION, 'edit_calltip.py')
main_window.editor.load(test_file)
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_message_box(qtbot))


@flaky(max_runs=10)
@pytest.mark.skipif(os.name == 'nt', reason="It times out sometimes on Windows")
def test_open_notebooks_from_project_explorer(main_window, qtbot):
Expand Down

0 comments on commit 8f8cd5c

Please sign in to comment.