def start(self): try: installed, path = check_if_kite_installed() if not installed: return logger.debug('Kite was found on the system: {0}'.format(path)) running = check_if_kite_running() if running: return logger.debug('Starting Kite service...') self.kite_process = run_program(path) except OSError: installed, path = check_if_kite_installed() logger.debug( 'Error starting Kite service at {path}...'.format(path=path)) if self.get_conf('show_installation_error_message'): err_str = _("It seems that your Kite installation is faulty. " "If you want to use Kite, please remove the " "directory that appears bellow, " "and try a reinstallation:<br><br>" "<code>{kite_dir}</code>").format( kite_dir=osp.dirname(path)) dialog_wrapper = KiteInstallationErrorMessage.instance( err_str, self.set_conf) self.sig_show_widget.emit(dialog_wrapper) finally: # Always start client to support possibly undetected Kite builds self.client.start()
def test_kite_install(qtbot): """Test the correct execution of the installation process of kite.""" install_manager = KiteInstallationThread(None) installation_statuses = [] def installation_status(status): installation_statuses.append(status) def error_msg(error): # Should not enter here assert False def download_progress(progress, total): assert total != 0 def finished(): if sys.platform.startswith("linux"): expected_installation_status = [ DOWNLOADING_SCRIPT, DOWNLOADING_INSTALLER, INSTALLING, FINISHED] else: expected_installation_status = [ DOWNLOADING_INSTALLER, INSTALLING, FINISHED] # This status can be obtained the second time our tests are run if not installation_statuses == ['Installation finished']: assert installation_statuses == expected_installation_status install_manager.sig_installation_status.connect(installation_status) install_manager.sig_error_msg.connect(error_msg) install_manager.sig_download_progress.connect(download_progress) install_manager.finished.connect(finished) with qtbot.waitSignal(install_manager.finished, timeout=INSTALL_TIMEOUT): install_manager.install() # Check that kite was installed and is running qtbot.waitUntil( lambda: check_if_kite_installed() and check_if_kite_running(), timeout=5000)
cursor = code_editor.textCursor() cursor.movePosition(QTextCursor.StartOfBlock) cursor.movePosition(QTextCursor.EndOfBlock, mode=QTextCursor.KeepAnchor) text1 = cursor.selectedText() assert text1 == 'test_func(longer, y1, some_z)' CONF.set('completions', 'enable_code_snippets', False) completion_plugin.after_configuration_update([]) code_editor.toggle_automatic_completions(True) code_editor.toggle_code_snippets(True) @pytest.mark.slow @pytest.mark.skipif((not check_if_kite_installed() or not check_if_kite_running()), reason="It's not meant to be run without kite installed " "and running") def test_kite_code_snippets(kite_codeeditor, qtbot): """ Test kite code snippets completions without initial placeholder. See spyder-ide/spyder#10971 """ code_editor, kite = kite_codeeditor completion = code_editor.completion_widget snippets = code_editor.editor_extensions.get('SnippetsExtension') CONF.set('lsp-server', 'code_snippets', True) CONF.set('kite', 'enable', True) code_editor.toggle_automatic_completions(False)
cursor = code_editor.textCursor() cursor.movePosition(QTextCursor.StartOfBlock) cursor.movePosition(QTextCursor.EndOfBlock, mode=QTextCursor.KeepAnchor) text1 = cursor.selectedText() assert text1 == 'test_func(longer, y1, some_z)' CONF.set('completions', 'enable_code_snippets', False) completion_plugin.after_configuration_update([]) code_editor.toggle_automatic_completions(True) code_editor.toggle_code_snippets(True) @pytest.mark.slow @pytest.mark.skipif( (not check_if_kite_installed() or not check_if_kite_running()), reason="It's not meant to be run without kite installed " "and running") def test_kite_code_snippets(kite_codeeditor, qtbot): """ Test kite code snippets completions without initial placeholder. See spyder-ide/spyder#10971 """ code_editor, kite = kite_codeeditor completion = code_editor.completion_widget snippets = code_editor.editor_extensions.get('SnippetsExtension') CONF.set('lsp-server', 'code_snippets', True) CONF.set('kite', 'enable', True) code_editor.toggle_automatic_completions(False)