Ejemplo n.º 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"]
        )
Ejemplo n.º 2
0
    def test_uninstall(self):
        with fake_pip():
            ensurepip._uninstall_helper()

        self.run_pip.assert_called_once_with(
            ["uninstall", "-y", "pip", "setuptools"]
        )
Ejemplo n.º 3
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)
Ejemplo n.º 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)
Ejemplo n.º 5
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', '--disable-pip-version-check', '-vvv', 'pip',
         'setuptools'
     ])
Ejemplo n.º 6
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", "--disable-pip-version-check", "-vvv", "pip", "setuptools"]
        )
Ejemplo n.º 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"]
        )
Ejemplo n.º 8
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)
Ejemplo n.º 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",
            ]
        )
Ejemplo n.º 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",
            ]
        )
Ejemplo n.º 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",
        ])
Ejemplo n.º 13
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)
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 16
0
 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)
Ejemplo n.º 17
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()
Ejemplo n.º 18
0
 def test_pip_config_file_disabled(self):
     with fake_pip():
         ensurepip._uninstall_helper()
     self.assertEqual(self.os_environ['PIP_CONFIG_FILE'], os.devnull)
Ejemplo n.º 19
0
 def test_uninstall_skipped_when_not_installed(self):
     with fake_pip(None):
         ensurepip._uninstall_helper()
     self.assertFalse(self.run_pip.called)
Ejemplo n.º 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)
Ejemplo n.º 21
0
 def test_uninstall_skipped_when_not_installed(self):
     with fake_pip(None):
         ensurepip._uninstall_helper()
     self.assertFalse(self.run_pip.called)
Ejemplo n.º 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()