Exemple #1
0
    def test_uninstall_with_verbosity_3(self):
        with fake_pip():
            ensurepip._uninstall_helper(verbosity=3)

        self.run_pip.assert_called_once_with(
            ["uninstall", "-y", "-vvv", "pip", "setuptools"]
        )
Exemple #2
0
    def test_uninstall(self):
        with fake_pip():
            ensurepip._uninstall_helper()

        self.run_pip.assert_called_once_with(
            ["uninstall", "-y", "pip", "setuptools"]
        )
 def test_uninstall_skipped_with_warning_for_wrong_version(self):
     with fake_pip("not a valid version"):
         with test.support.captured_stderr() as stderr:
             ensurepip._uninstall_helper()
     warning = stderr.getvalue().strip()
     self.assertIn("only uninstall a matching version", warning)
     self.assertFalse(self.run_pip.called)
Exemple #4
0
 def test_pip_environment_variables_removed(self):
     # ensurepip deliberately ignores all pip environment variables
     # See http://bugs.python.org/issue19734 for details
     self.os_environ["PIP_THIS_SHOULD_GO_AWAY"] = "test fodder"
     with fake_pip():
         ensurepip._uninstall_helper()
     self.assertNotIn("PIP_THIS_SHOULD_GO_AWAY", self.os_environ)
 def test_uninstall_with_verbosity_3(self):
     with fake_pip():
         ensurepip._uninstall_helper(verbosity=3)
     self.run_pip.assert_called_once_with([
         'uninstall', '-y', '--disable-pip-version-check', '-vvv', 'pip',
         'setuptools'
     ])
    def test_uninstall_with_verbosity_3(self):
        with fake_pip():
            ensurepip._uninstall_helper(verbosity=3)

        self.run_pip.assert_called_once_with(
            ["uninstall", "-y", "--disable-pip-version-check", "-vvv", "pip", "setuptools"]
        )
Exemple #7
0
    def test_uninstall_with_verbosity_2(self):
        with fake_pip():
            ensurepip._uninstall_helper(verbosity=2)

        self.run_pip.assert_called_once_with(
            ["uninstall", "-y", "-vv", "pip", "setuptools"]
        )
 def test_pip_environment_variables_removed(self):
     # ensurepip deliberately ignores all pip environment variables
     # See http://bugs.python.org/issue19734 for details
     self.os_environ["PIP_THIS_SHOULD_GO_AWAY"] = "test fodder"
     with fake_pip():
         ensurepip._uninstall_helper()
     self.assertNotIn("PIP_THIS_SHOULD_GO_AWAY", self.os_environ)
Exemple #9
0
 def test_uninstall_skipped_with_warning_for_wrong_version(self):
     with fake_pip("not a valid version"):
         with test.support.captured_stderr() as stderr:
             ensurepip._uninstall_helper()
     warning = stderr.getvalue().strip()
     self.assertIn("only uninstall a matching version", warning)
     self.assertFalse(self.run_pip.called)
    def test_uninstall(self):
        with fake_pip():
            ensurepip._uninstall_helper()

        self.run_pip.assert_called_once_with(
            [
                "uninstall", "-y", "--disable-pip-version-check", "pip",
                "setuptools",
            ]
        )
Exemple #11
0
    def test_uninstall_with_verbosity_2(self):
        with fake_pip():
            ensurepip._uninstall_helper(verbosity=2)

        self.run_pip.assert_called_once_with(
            [
                "uninstall", "-y", "--disable-pip-version-check", "-vv", "pip",
                "setuptools",
            ]
        )
Exemple #12
0
    def test_uninstall(self):
        with fake_pip():
            ensurepip._uninstall_helper()

        self.run_pip.assert_called_once_with([
            "uninstall",
            "-y",
            "--disable-pip-version-check",
            "pyparsing",
            "packaging",
            "appdirs",
            "six",
            "pip",
            "setuptools",
        ])
def _main(argv=None):
    parser = argparse.ArgumentParser(prog='python -m ensurepip._uninstall')
    parser.add_argument(
        '--version',
        action='version',
        version='pip {}'.format(ensurepip.version()),
        help='Show the version of pip this will attempt to uninstall.')
    parser.add_argument(
        '-v',
        '--verbose',
        action='count',
        default=0,
        dest='verbosity',
        help=
        'Give more output. Option is additive, and can be used up to 3 times.')
    args = parser.parse_args(argv)
    ensurepip._uninstall_helper(verbosity=args.verbosity)
Exemple #14
0
def _main(argv=None):
    parser = argparse.ArgumentParser(prog="python -m ensurepip._uninstall")
    parser.add_argument(
        "--version",
        action="version",
        version="pip {}".format(ensurepip.version()),
        help="Show the version of pip this will attempt to uninstall.",
    )
    parser.add_argument(
        "-v", "--verbose",
        action="count",
        default=0,
        dest="verbosity",
        help=("Give more output. Option is additive, and can be used up to 3 "
              "times."),
    )

    args = parser.parse_args(argv)

    ensurepip._uninstall_helper(verbosity=args.verbosity)
Exemple #15
0
 def test_pip_config_file_disabled(self):
     # ensurepip deliberately ignores the pip config file
     # See http://bugs.python.org/issue20053 for details
     with fake_pip():
         ensurepip._uninstall_helper()
     self.assertEqual(self.os_environ["PIP_CONFIG_FILE"], os.devnull)
 def test_pip_environment_variables_removed(self):
     self.os_environ['PIP_THIS_SHOULD_GO_AWAY'] = 'test fodder'
     with fake_pip():
         ensurepip._uninstall_helper()
     self.assertNotIn('PIP_THIS_SHOULD_GO_AWAY', self.os_environ)
 def test_uninstall_fails_with_wrong_version(self):
     with fake_pip("not a valid version"):
         with self.assertRaises(RuntimeError):
             ensurepip._uninstall_helper()
     self.run_pip.assert_not_called()
 def test_pip_config_file_disabled(self):
     with fake_pip():
         ensurepip._uninstall_helper()
     self.assertEqual(self.os_environ['PIP_CONFIG_FILE'], os.devnull)
Exemple #19
0
 def test_uninstall_skipped_when_not_installed(self):
     with fake_pip(None):
         ensurepip._uninstall_helper()
     self.assertFalse(self.run_pip.called)
Exemple #20
0
 def test_pip_config_file_disabled(self):
     # ensurepip deliberately ignores the pip config file
     # See http://bugs.python.org/issue20053 for details
     with fake_pip():
         ensurepip._uninstall_helper()
     self.assertEqual(self.os_environ["PIP_CONFIG_FILE"], os.devnull)
Exemple #21
0
 def test_uninstall_skipped_when_not_installed(self):
     with fake_pip(None):
         ensurepip._uninstall_helper()
     self.assertFalse(self.run_pip.called)
Exemple #22
0
 def test_uninstall_fails_with_wrong_version(self):
     with fake_pip("not a valid version"):
         with self.assertRaises(RuntimeError):
             ensurepip._uninstall_helper()
     self.run_pip.assert_not_called()