Skip to content

Commit

Permalink
Use qtbot.waitUntil and skip test if no_display
Browse files Browse the repository at this point in the history
  • Loading branch information
dalthviz committed Jan 6, 2025
1 parent 61fd484 commit a1e9d2b
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion qtconsole/tests/test_00_console_widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ def qtconsole(qtbot):
console.window.close()


@pytest.mark.skipif(no_display, reason="Doesn't work without a display")
def test_history_complete(qtconsole, qtbot):
"""
Test history complete widget
Expand All @@ -51,13 +52,16 @@ def test_history_complete(qtconsole, qtbot):
shell.execute("import time")

qtbot.keyClicks(control, "imp")

qtbot.keyClick(
control,
QtCore.Qt.Key_R,
modifier=QtCore.Qt.ControlModifier | QtCore.Qt.ShiftModifier,
)
qtbot.wait(1000)
qtbot.waitUntil(lambda: shell._history_list_widget.isVisible())

qtbot.keyClick(shell._history_list_widget, QtCore.Qt.Key_Enter)
qtbot.waitUntil(lambda: not shell._history_list_widget.isVisible())

assert shell.input_buffer == "import time"

Expand Down

0 comments on commit a1e9d2b

Please sign in to comment.