当前位置: 首页>>代码示例>>Python>>正文


Python PipManager.pip_installer_fname方法代码示例

本文整理汇总了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)
开发者ID:malderete,项目名称:fades,代码行数:15,代码来源:test_pipmanager.py

示例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)
开发者ID:malderete,项目名称:fades,代码行数:15,代码来源:test_pipmanager.py

示例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)
开发者ID:malderete,项目名称:fades,代码行数:18,代码来源:test_pipmanager.py


注:本文中的fades.pipmanager.PipManager.pip_installer_fname方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。