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

        self.run_pip.assert_called_once_with(
            ["uninstall", "-y", "pip", "setuptools"]
        )
Example #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)
Example #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'
     ])
Example #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"]
        )
Example #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"]
        )
Example #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)
Example #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",
            ]
        )
Example #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",
            ]
        )
Example #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",
        ])
Example #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)
Example #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)
Example #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)
Example #19
0
 def test_uninstall_skipped_when_not_installed(self):
     with fake_pip(None):
         ensurepip._uninstall_helper()
     self.assertFalse(self.run_pip.called)
Example #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)
Example #21
0
 def test_uninstall_skipped_when_not_installed(self):
     with fake_pip(None):
         ensurepip._uninstall_helper()
     self.assertFalse(self.run_pip.called)
Example #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()