Python setuptools.sandbox 模块,setup_context() 实例源码

我们从Python开源项目中,提取了以下15个代码示例,用于说明如何使用setuptools.sandbox.setup_context()

项目:Sudoku-Solver    作者:ayush1997    | 项目源码 | 文件源码
def setup_context(tmpdir):
    with (tmpdir/'setup.py').open('w') as f:
        f.write(SETUP_PY)
    with tmpdir.as_cwd():
        yield tmpdir
项目:Sudoku-Solver    作者:ayush1997    | 项目源码 | 文件源码
def user_install_setup_context(self, *args, **kwargs):
        """
        Wrap sandbox.setup_context to patch easy_install in that context to
        appear as user-installed.
        """
        with self.orig_context(*args, **kwargs):
            import setuptools.command.easy_install as ei
            ei.__file__ = site.USER_SITE
            yield
项目:Sudoku-Solver    作者:ayush1997    | 项目源码 | 文件源码
def patched_setup_context(self):
        self.orig_context = sandbox.setup_context

        return mock.patch(
            'setuptools.sandbox.setup_context',
            self.user_install_setup_context,
        )
项目:setuptools    作者:pypa    | 项目源码 | 文件源码
def setup_context(tmpdir):
    with (tmpdir / 'setup.py').open('w') as f:
        f.write(SETUP_PY)
    with tmpdir.as_cwd():
        yield tmpdir
项目:setuptools    作者:pypa    | 项目源码 | 文件源码
def user_install_setup_context(self, *args, **kwargs):
        """
        Wrap sandbox.setup_context to patch easy_install in that context to
        appear as user-installed.
        """
        with self.orig_context(*args, **kwargs):
            import setuptools.command.easy_install as ei
            ei.__file__ = site.USER_SITE
            yield
项目:setuptools    作者:pypa    | 项目源码 | 文件源码
def patched_setup_context(self):
        self.orig_context = sandbox.setup_context

        return mock.patch(
            'setuptools.sandbox.setup_context',
            self.user_install_setup_context,
        )
项目:browser_vuln_check    作者:lcatro    | 项目源码 | 文件源码
def setup_context(tmpdir):
    with (tmpdir / 'setup.py').open('w') as f:
        f.write(SETUP_PY)
    with tmpdir.as_cwd():
        yield tmpdir
项目:browser_vuln_check    作者:lcatro    | 项目源码 | 文件源码
def user_install_setup_context(self, *args, **kwargs):
        """
        Wrap sandbox.setup_context to patch easy_install in that context to
        appear as user-installed.
        """
        with self.orig_context(*args, **kwargs):
            import setuptools.command.easy_install as ei
            ei.__file__ = site.USER_SITE
            yield
项目:browser_vuln_check    作者:lcatro    | 项目源码 | 文件源码
def patched_setup_context(self):
        self.orig_context = sandbox.setup_context

        return mock.patch(
            'setuptools.sandbox.setup_context',
            self.user_install_setup_context,
        )
项目:facebook-face-recognition    作者:mathur    | 项目源码 | 文件源码
def setup_context(tmpdir):
    with (tmpdir/'setup.py').open('w') as f:
        f.write(SETUP_PY)
    with tmpdir.as_cwd():
        yield tmpdir
项目:facebook-face-recognition    作者:mathur    | 项目源码 | 文件源码
def user_install_setup_context(self, *args, **kwargs):
        """
        Wrap sandbox.setup_context to patch easy_install in that context to
        appear as user-installed.
        """
        with self.orig_context(*args, **kwargs):
            import setuptools.command.easy_install as ei
            ei.__file__ = site.USER_SITE
            yield
项目:facebook-face-recognition    作者:mathur    | 项目源码 | 文件源码
def patched_setup_context(self):
        self.orig_context = sandbox.setup_context

        return mock.patch(
            'setuptools.sandbox.setup_context',
            self.user_install_setup_context,
        )
项目:MyFriend-Rob    作者:lcheniv    | 项目源码 | 文件源码
def setup_context(tmpdir):
    with (tmpdir/'setup.py').open('w') as f:
        f.write(SETUP_PY)
    with tmpdir.as_cwd():
        yield tmpdir
项目:MyFriend-Rob    作者:lcheniv    | 项目源码 | 文件源码
def user_install_setup_context(self, *args, **kwargs):
        """
        Wrap sandbox.setup_context to patch easy_install in that context to
        appear as user-installed.
        """
        with self.orig_context(*args, **kwargs):
            import setuptools.command.easy_install as ei
            ei.__file__ = site.USER_SITE
            yield
项目:MyFriend-Rob    作者:lcheniv    | 项目源码 | 文件源码
def patched_setup_context(self):
        self.orig_context = sandbox.setup_context

        return mock.patch(
            'setuptools.sandbox.setup_context',
            self.user_install_setup_context,
        )