本文整理汇总了Python中fades.pipmanager.PipManager.pip_installer_fname方法的典型用法代码示例。如果您正苦于以下问题:Python PipManager.pip_installer_fname方法的具体用法?Python PipManager.pip_installer_fname怎么用?Python PipManager.pip_installer_fname使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类fades.pipmanager.PipManager
的用法示例。
在下文中一共展示了PipManager.pip_installer_fname方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_download_pip_installer
# 需要导入模块: from fades.pipmanager import PipManager [as 别名]
# 或者: from fades.pipmanager.PipManager import pip_installer_fname [as 别名]
def test_download_pip_installer(self):
mgr = PipManager(BIN_PATH, pip_installed=False)
# get a tempfile and remove it, so later the installer is downloaded there
tempfile = get_tempfile(self)
os.remove(tempfile)
mgr.pip_installer_fname = tempfile
with patch('fades.pipmanager.request.urlopen') as urlopen:
urlopen.return_value = io.BytesIO(b'hola')
mgr._download_pip_installer()
self.assertTrue(os.path.exists(mgr.pip_installer_fname))
urlopen.assert_called_once_with(pipmanager.PIP_INSTALLER)
示例2: test_brute_force_install_pip_installer_exists
# 需要导入模块: from fades.pipmanager import PipManager [as 别名]
# 或者: from fades.pipmanager.PipManager import pip_installer_fname [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)
示例3: test_brute_force_install_pip_no_installer
# 需要导入模块: from fades.pipmanager import PipManager [as 别名]
# 或者: from fades.pipmanager.PipManager import pip_installer_fname [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)