本文整理匯總了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)