Skip to content

Commit

Permalink
Testing: Fix tests that use keyboard shortcuts
Browse files Browse the repository at this point in the history
  • Loading branch information
ccordoba12 committed Nov 20, 2024
1 parent b96d31b commit 251ca02
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
4 changes: 4 additions & 0 deletions spyder/app/tests/test_mainwindow.py
Original file line number Diff line number Diff line change
Expand Up @@ -5374,6 +5374,10 @@ def test_copy_paste(main_window, qtbot, tmpdir):
code_editor = main_window.editor.get_focus_widget()
code_editor.set_text(code)

# Register codeeditor shortcuts
CONF.notify_section_all_observers("shortcuts")
qtbot.wait(300)

# Test copy
cursor = code_editor.textCursor()
cursor.setPosition(69)
Expand Down
8 changes: 8 additions & 0 deletions spyder/plugins/editor/widgets/codeeditor/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,10 @@ def mock_completions_codeeditor(qtbot_module, request):
qtbot_module.addWidget(editor)
editor.show()

# Register shortcuts for CodeEditor
CONF.notify_section_all_observers("shortcuts")
qtbot_module.wait(300)

mock_response = Mock()

def perform_request(lang, method, params):
Expand Down Expand Up @@ -182,6 +186,10 @@ def completions_codeeditor(completion_plugin_all_started, qtbot_module,
completion_plugin, capabilities = completion_plugin_all_started
completion_plugin.wait_for_ms = 2000

# Register shortcuts for CodeEditor
CONF.notify_section_all_observers("shortcuts")
qtbot_module.wait(300)

CONF.set('completions', 'enable_code_snippets', False)
completion_plugin.after_configuration_update([])
CONF.notify_section_all_observers('completions')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@

# Local imports
from spyder.config.base import running_in_ci
from spyder.config.manager import CONF
from spyder.plugins.editor.widgets.gotoline import GoToLineDialog
from spyder.plugins.editor.widgets.editorstack import EditorStack
from spyder.config.manager import CONF


# ---- Qt Test Fixtures
Expand All @@ -42,6 +42,10 @@ def editorstack(qtbot):
editorstack.show()
editorstack.go_to_line(1)

# Register shortcuts
CONF.notify_section_all_observers("shortcuts")
qtbot.wait(300)

return editorstack


Expand Down

0 comments on commit 251ca02

Please sign in to comment.