Exemple #1
0
    def __init__(self, parent):
        SpyderCompletionPlugin.__init__(self, parent)
        self.available_languages = []
        self.client = KiteClient(None)
        self.kite_process = None

        # Installation dialog
        self.installation_thread = KiteInstallationThread(self)
        self.installer = KiteInstallerDialog(parent, self.installation_thread)

        # Status widget
        statusbar = parent.statusBar()  # MainWindow status bar
        self.open_file_updated = False
        self.status_widget = KiteStatusWidget(None, statusbar, self)

        # Signals
        self.client.sig_client_started.connect(self.http_client_ready)
        self.client.sig_status_response_ready[str].connect(self.set_status)
        self.client.sig_status_response_ready[dict].connect(self.set_status)
        self.client.sig_response_ready.connect(
            functools.partial(self.sig_response_ready.emit,
                              self.COMPLETION_CLIENT_NAME))
        self.installation_thread.sig_installation_status.connect(
            self.set_status)
        self.status_widget.sig_clicked.connect(self.show_installation_dialog)
        self.main.sig_setup_finished.connect(self.mainwindow_setup_finished)

        # Config
        self.update_configuration()
Exemple #2
0
 def __init__(self, parent):
     SpyderCompletionPlugin.__init__(self, parent)
     self.available_languages = []
     self.client = KiteClient(None)
     self.kite_process = None
     self.kite_installation_thread = KiteInstallationThread(self)
     # TODO: Connect thread status to status bar
     self.kite_installer = KiteInstallerDialog(
         parent,
         self.kite_installation_thread)
     self.client.sig_client_started.connect(self.http_client_ready)
     self.client.sig_response_ready.connect(
         functools.partial(self.sig_response_ready.emit,
                           self.COMPLETION_CLIENT_NAME))
     self.kite_installation_thread.sig_installation_status.connect(
         lambda status: self.client.start() if status == FINISHED else None)
     self.main.sig_setup_finished.connect(self.mainwindow_setup_finished)
     self.update_configuration()
Exemple #3
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)
Exemple #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):
        assert re.match(r"(\d+)/(\d+)", progress)

    def finished():
        if sys.platform.startswith("linux"):
            expected_installation_status = [
                install_manager.DOWNLOADING_SCRIPT,
                install_manager.DOWNLOADING_INSTALLER,
                install_manager.INSTALLING, install_manager.FINISHED
            ]
        else:
            expected_installation_status = [
                install_manager.DOWNLOADING_INSTALLER,
                install_manager.INSTALLING, install_manager.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()

    assert check_if_kite_installed and check_if_kite_running