本文整理汇总了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)