def test_uninstall_with_verbosity_3(self): with fake_pip(): ensurepip._uninstall(verbosity=3) self.run_pip.assert_called_once_with( ["uninstall", "-y", "-vvv", "pip", "setuptools"] )
def test_uninstall(self): with fake_pip(): ensurepip._uninstall() self.run_pip.assert_called_once_with( ["uninstall", "-y", "pip", "setuptools"] )
def main(): 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() ensurepip._uninstall(verbosity=args.verbosity)
def test_uninstall_fails_with_wrong_version(self): with fake_pip("not a valid version"): with self.assertRaises(RuntimeError): ensurepip._uninstall() self.run_pip.assert_not_called()
def test_uninstall_skipped_when_not_installed(self): with fake_pip(None): ensurepip._uninstall() self.run_pip.assert_not_called()