Esempio n. 1
0
    def test_should_install_plugin(self, execute, _, read_file):
        read_file.return_value = ["no problems", "so far"]
        execute.return_value = 0

        _install_external_plugin("pypi:some-plugin", Mock())

        execute.assert_called_with('pip install some-plugin', ANY, shell=True, error_file_name=ANY)
    def test_should_install_plugin_with_vcs_and_version(self, execute, _, read_file):
        read_file.return_value = ["no problems", "so far"]
        execute.return_value = 0

        _install_external_plugin("vcs:some-plugin URL", "===1.2.3", Mock(), None)

        execute.assert_called_with(PIP_EXEC_STANZA + ['install', '--force-reinstall', 'some-plugin URL'], shell=False,
                                   outfile_name=ANY, error_file_name=ANY, cwd=".", env=ANY)
Esempio n. 3
0
    def test_should_install_plugin_with_vcs_and_version(self, execute, _, read_file):
        read_file.return_value = ["no problems", "so far"]
        execute.return_value = 0

        _install_external_plugin("vcs:some-plugin URL", "===1.2.3", Mock(), None)

        execute.assert_called_with(['pip', 'install', '--upgrade', 'some-plugin URL'], ANY, shell=False,
                                   error_file_name=ANY, cwd=".")
    def test_should_install_plugin(self, execute, _, read_file):
        read_file.return_value = ["no problems", "so far"]
        execute.return_value = 0

        _install_external_plugin("pypi:some-plugin", None, Mock(), None)

        execute.assert_called_with(PIP_EXEC_STANZA + ['install', 'some-plugin'], shell=False,
                                   outfile_name=ANY, error_file_name=ANY, cwd=".", env=ANY)
Esempio n. 5
0
    def test_should_install_plugin(self, execute, _, read_file):
        read_file.return_value = ["no problems", "so far"]
        execute.return_value = 0

        _install_external_plugin("pypi:some-plugin", None, Mock(), None)

        execute.assert_called_with(['pip', 'install', '--upgrade', 'some-plugin'], ANY, shell=False,
                                   error_file_name=ANY, cwd=".")
Esempio n. 6
0
    def test_should_install_plugin_with_version(self, execute, _, read_file):
        read_file.return_value = ["no problems", "so far"]
        execute.return_value = 0

        _install_external_plugin("pypi:some-plugin", "===1.2.3", Mock(), None)

        execute.assert_called_with([ANY, 'install', '--upgrade', 'some-plugin===1.2.3'], shell=False,
                                   outfile_name=ANY, error_file_name=ANY, cwd=".", env=ANY)
    def test_should_install_plugin_with_vcs(self, execute, _, read_file):
        read_file.return_value = ["no problems", "so far"]
        execute.return_value = 0

        _install_external_plugin(Mock(), "vcs:some-plugin URL", None, Mock(), None)

        execute.assert_called_with(
            PIP_EXEC_STANZA + ['install', '--index-url', ANY, '--extra-index-url', ANY, '--trusted-host', ANY,
                               '--force-reinstall', 'some-plugin URL'], shell=False, outfile_name=ANY,
            error_file_name=ANY, cwd=".", env=ANY)
Esempio n. 8
0
    def test_should_install_plugin(self, execute, tempfile, read_file):
        read_file.return_value = ["no problems", "so far"]
        execute.return_value = 0
        tempfile.NamedTemporaryFile().__enter__().name.__eq__.return_value = True

        _install_external_plugin(Mock(), "pypi:some-plugin", None, Mock(), None)

        execute.assert_called_with(
            PIP_EXEC_STANZA + ['install', '--index-url', ANY, '--extra-index-url', ANY, '--trusted-host', ANY,
                               'some-plugin'], shell=False, outfile_name=ANY, error_file_name=ANY, cwd=".", env=ANY)
Esempio n. 9
0
    def test_should_install_plugin(self, execute, tempfile, read_file):
        read_file.return_value = ["no problems", "so far"]
        execute.return_value = 0
        tempfile.NamedTemporaryFile().__enter__().name.__eq__.return_value = True

        _install_external_plugin(Mock(), "pypi:some-plugin", None, Mock(), None)

        execute.assert_called_with(
            PIP_EXEC_STANZA + ['install', '--index-url', ANY, '--extra-index-url', ANY, '--trusted-host', ANY,
                               'some-plugin'], shell=False, outfile_name=ANY, error_file_name=ANY, cwd=".", env=ANY)
Esempio n. 10
0
    def test_should_install_plugin_with_version(self, execute, _, read_file):
        read_file.return_value = ["no problems", "so far"]
        execute.return_value = 0

        _install_external_plugin("pypi:some-plugin", "===1.2.3", Mock())

        execute.assert_called_with(
            ['pip', 'install', '--upgrade', '--pre', 'some-plugin===1.2.3'],
            ANY,
            shell=True,
            error_file_name=ANY)
Esempio n. 11
0
    def test_should_install_plugin_with_version(self, execute, tempfile, read_file):
        read_file.return_value = ["no problems", "so far"]
        execute.return_value = 0
        tempfile.NamedTemporaryFile().__enter__().name.__eq__.return_value = True

        _install_external_plugin(Mock(), "pypi:some-plugin", "===1.2.3", Mock(), None)

        execute.assert_called_with(
            PIP_EXEC_STANZA + ['install', '--index-url', ANY, '--extra-index-url', ANY, '--trusted-host', ANY] +
            (["--upgrade"] if pip_utils.pip_version < "9.0" else ["--upgrade", "--upgrade-strategy", "only-if-needed"])
            + ['some-plugin===1.2.3'], shell=False, outfile_name=ANY, error_file_name=ANY, cwd=".", env=ANY)
Esempio n. 12
0
    def test_should_install_plugin_with_version(self, execute, tempfile, read_file):
        read_file.return_value = ["no problems", "so far"]
        execute.return_value = 0
        tempfile.NamedTemporaryFile().__enter__().name.__eq__.return_value = True

        _install_external_plugin(Mock(), "pypi:some-plugin", "===1.2.3", Mock(), None)

        execute.assert_called_with(
            PIP_EXEC_STANZA + ['install', '--index-url', ANY, '--extra-index-url', ANY, '--trusted-host', ANY] +
            (["--upgrade"] if pip_common.pip_version < "9.0" else ["--upgrade", "--upgrade-strategy", "only-if-needed"])
            + ['some-plugin===1.2.3'], shell=False, outfile_name=ANY, error_file_name=ANY, cwd=".", env=ANY)
Esempio n. 13
0
    def test_should_install_plugin_with_vcs(self, execute, _, read_file):
        read_file.return_value = ["no problems", "so far"]
        execute.return_value = 0

        _install_external_plugin("vcs:some-plugin URL", None, Mock(), None)

        execute.assert_called_with(
            ['pip', 'install', '--upgrade', 'some-plugin URL'],
            ANY,
            shell=False,
            error_file_name=ANY,
            cwd=".")
Esempio n. 14
0
    def test_should_install_plugin_with_vcs(self, execute, _, read_file):
        read_file.return_value = ["no problems", "so far"]
        execute.return_value = 0

        _install_external_plugin(Mock(), "vcs:some-plugin URL", None, Mock(),
                                 None)

        execute.assert_called_with(PIP_EXEC_STANZA + [
            'install', '--index-url', ANY, '--extra-index-url', ANY,
            '--trusted-host', ANY, '--force-reinstall', 'some-plugin URL'
        ],
                                   shell=False,
                                   outfile_name=ANY,
                                   error_file_name=ANY,
                                   cwd=".",
                                   env=ANY)
Esempio n. 15
0
    def test_should_install_plugin_with_version(self, execute, _, read_file):
        read_file.return_value = ["no problems", "so far"]
        execute.return_value = 0

        _install_external_plugin(Mock(), "pypi:some-plugin", "===1.2.3",
                                 Mock(), None)

        execute.assert_called_with(PIP_EXEC_STANZA + [
            'install', '--index-url', ANY, '--extra-index-url', ANY,
            '--trusted-host', ANY, '--upgrade', 'some-plugin===1.2.3'
        ],
                                   shell=False,
                                   outfile_name=ANY,
                                   error_file_name=ANY,
                                   cwd=".",
                                   env=ANY)