示例#1
0
 def start(self):
     installed, path = check_if_kite_installed()
     if installed:
         logger.debug('Kite was found on the system: {0}'.format(path))
         running = check_if_kite_running()
         if not running:
             logger.debug('Starting Kite service...')
             self.kite_process = run_program(path)
         self.client.start()
示例#2
0
    def start(self):
        # Always start client to support possibly undetected Kite builds
        self.client.start()

        if not self.enabled:
            return
        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)
示例#3
0
    def start(self):
        try:
            if not self.enabled:
                return
            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_option('show_installation_error_message'):
                box = MessageCheckBox(icon=QMessageBox.Critical,
                                      parent=self.main)
                box.setWindowTitle(_("Kite installation error"))
                box.set_checkbox_text(_("Don't show again."))
                box.setStandardButtons(QMessageBox.Ok)
                box.setDefaultButton(QMessageBox.Ok)

                box.set_checked(False)
                box.set_check_visible(True)
                box.setText(
                    _("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)))

                box.exec_()

                # Update checkbox based on user interaction
                self.set_option('show_installation_error_message',
                                not box.is_checked())
        finally:
            # Always start client to support possibly undetected Kite builds
            self.client.start()
示例#4
0
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)
示例#5
0
    cursor.movePosition(QTextCursor.StartOfBlock)
    cursor.movePosition(QTextCursor.EndOfBlock, mode=QTextCursor.KeepAnchor)
    text1 = cursor.selectedText()
    assert text1 == 'test_func(longer, y1, some_z)'

    CONF.set('lsp-server', 'code_snippets', False)
    lsp.update_configuration()

    code_editor.toggle_automatic_completions(True)
    code_editor.toggle_code_snippets(True)


@pytest.mark.slow
@pytest.mark.skipif((not rtree_available
                     or not check_if_kite_installed()
                     or not check_if_kite_running()),
                    reason="Only works if rtree is installed."
                           "It's not meant to be run without kite installed "
                           "and runnning")
def test_kite_code_snippets(kite_codeeditor, qtbot):
    """
    Test kite code snippets completions without initial placeholder.

    See spyder-ide/spyder#10971
    """
    assert rtree_available
    code_editor, kite = kite_codeeditor
    completion = code_editor.completion_widget
    snippets = code_editor.editor_extensions.get('SnippetsExtension')

    CONF.set('lsp-server', 'code_snippets', True)