本文整理匯總了Python中ensurepip._uninstall_helper方法的典型用法代碼示例。如果您正苦於以下問題:Python ensurepip._uninstall_helper方法的具體用法?Python ensurepip._uninstall_helper怎麽用?Python ensurepip._uninstall_helper使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類ensurepip
的用法示例。
在下文中一共展示了ensurepip._uninstall_helper方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: _main
# 需要導入模塊: import ensurepip [as 別名]
# 或者: from ensurepip import _uninstall_helper [as 別名]
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)
return ensurepip._uninstall_helper(verbosity=args.verbosity)
示例2: _main
# 需要導入模塊: import ensurepip [as 別名]
# 或者: from ensurepip import _uninstall_helper [as 別名]
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)
示例3: test_uninstall_skipped_when_not_installed
# 需要導入模塊: import ensurepip [as 別名]
# 或者: from ensurepip import _uninstall_helper [as 別名]
def test_uninstall_skipped_when_not_installed(self):
with fake_pip(None):
ensurepip._uninstall_helper()
self.assertFalse(self.run_pip.called)
示例4: test_uninstall_skipped_with_warning_for_wrong_version
# 需要導入模塊: import ensurepip [as 別名]
# 或者: from ensurepip import _uninstall_helper [as 別名]
def test_uninstall_skipped_with_warning_for_wrong_version(self):
with fake_pip("not a valid version"):
with test.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)
示例5: test_uninstall
# 需要導入模塊: import ensurepip [as 別名]
# 或者: from ensurepip import _uninstall_helper [as 別名]
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",
]
)
示例6: test_uninstall_with_verbosity_1
# 需要導入模塊: import ensurepip [as 別名]
# 或者: from ensurepip import _uninstall_helper [as 別名]
def test_uninstall_with_verbosity_1(self):
with fake_pip():
ensurepip._uninstall_helper(verbosity=1)
self.run_pip.assert_called_once_with(
[
"uninstall", "-y", "--disable-pip-version-check", "-v", "pip",
"setuptools",
]
)
示例7: test_uninstall_with_verbosity_3
# 需要導入模塊: import ensurepip [as 別名]
# 或者: from ensurepip import _uninstall_helper [as 別名]
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",
]
)
示例8: test_pip_environment_variables_removed
# 需要導入模塊: import ensurepip [as 別名]
# 或者: from ensurepip import _uninstall_helper [as 別名]
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)
示例9: test_pip_config_file_disabled
# 需要導入模塊: import ensurepip [as 別名]
# 或者: from ensurepip import _uninstall_helper [as 別名]
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)
# Basic testing of the main functions and their argument parsing
示例10: test_uninstall
# 需要導入模塊: import ensurepip [as 別名]
# 或者: from ensurepip import _uninstall_helper [as 別名]
def test_uninstall(self):
with fake_pip():
ensurepip._uninstall_helper()
self.run_pip.assert_called_once_with(
["uninstall", "-y", "pip", "setuptools"]
)
示例11: test_uninstall_with_verbosity_1
# 需要導入模塊: import ensurepip [as 別名]
# 或者: from ensurepip import _uninstall_helper [as 別名]
def test_uninstall_with_verbosity_1(self):
with fake_pip():
ensurepip._uninstall_helper(verbosity=1)
self.run_pip.assert_called_once_with(
["uninstall", "-y", "-v", "pip", "setuptools"]
)
示例12: test_uninstall_with_verbosity_3
# 需要導入模塊: import ensurepip [as 別名]
# 或者: from ensurepip import _uninstall_helper [as 別名]
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"]
)
示例13: test_pip_config_file_disabled
# 需要導入模塊: import ensurepip [as 別名]
# 或者: from ensurepip import _uninstall_helper [as 別名]
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)
示例14: test_uninstall_requires_ssl
# 需要導入模塊: import ensurepip [as 別名]
# 或者: from ensurepip import _uninstall_helper [as 別名]
def test_uninstall_requires_ssl(self):
self.os_environ["PIP_THIS_SHOULD_STAY"] = "test fodder"
with self.assertRaisesRegexp(RuntimeError, "requires SSL/TLS"):
with fake_pip():
ensurepip_no_ssl._uninstall_helper()
self.assertFalse(self.run_pip.called)
self.assertIn("PIP_THIS_SHOULD_STAY", self.os_environ)
示例15: test_uninstall_skipped_with_warning_for_wrong_version
# 需要導入模塊: import ensurepip [as 別名]
# 或者: from ensurepip import _uninstall_helper [as 別名]
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)