本文整理汇总了Python中fades.pipmanager.PipManager._brute_force_install_pip方法的典型用法代码示例。如果您正苦于以下问题:Python PipManager._brute_force_install_pip方法的具体用法?Python PipManager._brute_force_install_pip怎么用?Python PipManager._brute_force_install_pip使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类fades.pipmanager.PipManager
的用法示例。
在下文中一共展示了PipManager._brute_force_install_pip方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_brute_force_install_pip_installer_exists
# 需要导入模块: from fades.pipmanager import PipManager [as 别名]
# 或者: from fades.pipmanager.PipManager import _brute_force_install_pip [as 别名]
def test_brute_force_install_pip_installer_exists(self):
mgr = PipManager(BIN_PATH, pip_installed=False)
python_path = os.path.join(BIN_PATH, 'python')
with patch.object(helpers, 'logged_exec') as mocked_exec, \
patch.object(mgr, '_download_pip_installer') as download_installer:
# get the tempfile but leave it there to be found
mgr.pip_installer_fname = get_tempfile(self)
mgr._brute_force_install_pip()
self.assertEqual(download_installer.call_count, 0)
mocked_exec.assert_called_with([python_path, mgr.pip_installer_fname, '-I'])
self.assertTrue(mgr.pip_installed)
示例2: test_brute_force_install_pip_no_installer
# 需要导入模块: from fades.pipmanager import PipManager [as 别名]
# 或者: from fades.pipmanager.PipManager import _brute_force_install_pip [as 别名]
def test_brute_force_install_pip_no_installer(self):
mgr = PipManager(BIN_PATH, pip_installed=False)
python_path = os.path.join(BIN_PATH, 'python')
with patch.object(helpers, 'logged_exec') as mocked_exec, \
patch.object(mgr, '_download_pip_installer') as download_installer:
# get the tempfile and remove it so then it's not found
tempfile = get_tempfile(self)
os.remove(tempfile)
mgr.pip_installer_fname = tempfile
mgr._brute_force_install_pip()
download_installer.assert_called_once_with()
mocked_exec.assert_called_with([python_path, mgr.pip_installer_fname, '-I'])
self.assertTrue(mgr.pip_installed)