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


Python Context.run方法代码示例

本文整理汇总了Python中invoke.Context.run方法的典型用法代码示例。如果您正苦于以下问题:Python Context.run方法的具体用法?Python Context.run怎么用?Python Context.run使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在invoke.Context的用法示例。


在下文中一共展示了Context.run方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: honors_runner_config_setting

# 需要导入模块: from invoke import Context [as 别名]
# 或者: from invoke.Context import run [as 别名]
 def honors_runner_config_setting(self):
     runner_class = Mock()
     config = Config({'runners': {'local': runner_class}})
     c = Context(config)
     c.run('foo')
     assert runner_class.mock_calls == [
         call(c), call().run('foo'),
     ]
开发者ID:yws,项目名称:invoke,代码行数:10,代码来源:context.py

示例2: prefixes_should_apply_to_run

# 需要导入模块: from invoke import Context [as 别名]
# 或者: from invoke.Context import run [as 别名]
        def prefixes_should_apply_to_run(self, Local):
            runner = Local.return_value
            c = Context()
            with c.prefix("cd foo"):
                c.run("whoami")

            cmd = "cd foo && whoami"
            assert runner.run.called, "run() never called runner.run()!"
            assert runner.run.call_args[0][0] == cmd
开发者ID:miradam,项目名称:invoke,代码行数:11,代码来源:context.py

示例3: prefixes_should_apply_to_run

# 需要导入模块: from invoke import Context [as 别名]
# 或者: from invoke.Context import run [as 别名]
        def prefixes_should_apply_to_run(self, Local):
            runner = Local.return_value
            ctx = Context()
            with ctx.prefix('cd foo'):
                ctx.run('whoami')

            cmd = "cd foo && whoami"
            ok_(runner.run.called, "run() never called runner.run()!")
            eq_(runner.run.call_args[0][0], cmd)
开发者ID:yws,项目名称:invoke,代码行数:11,代码来源:context.py

示例4: cd_should_apply_to_run

# 需要导入模块: from invoke import Context [as 别名]
# 或者: from invoke.Context import run [as 别名]
        def cd_should_apply_to_run(self, Local):
            runner = Local.return_value
            c = Context()
            with c.cd('foo'):
                c.run('whoami')

            cmd = "cd foo && whoami"
            assert runner.run.called, "run() never called runner.run()!"
            assert runner.run.call_args[0][0] == cmd
开发者ID:offbyone,项目名称:invoke,代码行数:11,代码来源:context.py

示例5: cd_should_occur_before_prefixes

# 需要导入模块: from invoke import Context [as 别名]
# 或者: from invoke.Context import run [as 别名]
        def cd_should_occur_before_prefixes(self, Local):
            runner = Local.return_value
            c = Context()
            with c.prefix("source venv"):
                with c.cd("foo"):
                    c.run("whoami")

            cmd = "cd foo && source venv && whoami"
            assert runner.run.called, "run() never called runner.run()!"
            assert runner.run.call_args[0][0] == cmd
开发者ID:miradam,项目名称:invoke,代码行数:12,代码来源:context.py

示例6: cd_should_occur_before_prefixes

# 需要导入模块: from invoke import Context [as 别名]
# 或者: from invoke.Context import run [as 别名]
        def cd_should_occur_before_prefixes(self, Local):
            runner = Local.return_value
            ctx = Context()
            with ctx.prefix('source venv'):
                with ctx.cd('foo'):
                    ctx.run('whoami')

            cmd = "cd foo && source venv && whoami"
            ok_(runner.run.called, "run() never called runner.run()!")
            eq_(runner.run.call_args[0][0], cmd)
开发者ID:yws,项目名称:invoke,代码行数:12,代码来源:context.py

示例7: _build

# 需要导入模块: from invoke import Context [as 别名]
# 或者: from invoke.Context import run [as 别名]
def _build():
    """
    Build local support docs tree and return the build target dir for cleanup.
    """
    c = Context()
    support = join(dirname(__file__), "_support")
    docs = join(support, "docs")
    build = join(support, "_build")
    command = "sphinx-build -c {} -W {} {}".format(support, docs, build)
    with c.cd(support):
        # Turn off stdin mirroring to avoid irritating pytest.
        c.run(command, in_stream=False)
    return build
开发者ID:pyinvoke,项目名称:invocations,代码行数:15,代码来源:base.py

示例8: build

# 需要导入模块: from invoke import Context [as 别名]
# 或者: from invoke.Context import run [as 别名]
    def build(self, ctx: Context) -> None:
        if self.platform in [SupportedPlatformEnum.WINDOWS_32, SupportedPlatformEnum.WINDOWS_64]:
            if self.platform == SupportedPlatformEnum.WINDOWS_32:
                arch = 'x86'
                build_script = 'bld_ml32.bat'
                build_platform = 'Win32'
            else:
                arch = 'x64'
                build_script = 'bld_ml64.bat'
                build_platform = 'x64'

            masm_path = self.src_path / 'contrib' / f'masm{arch}'
            with ctx.cd(str(masm_path)):
                ctx.run(build_script)
                ctx.run(f'msbuild ..\\vstudio\\vc14\\zlibvc.sln /P:Configuration=Release /P:Platform={build_platform}')

        else:
            # Linux/macOS build
            with ctx.cd(str(self.src_path)):
                ctx.run('CFLAGS="-fPIC" ./configure -static')
                ctx.run('make clean')
                ctx.run('make')
开发者ID:nabla-c0d3,项目名称:nassl,代码行数:24,代码来源:build_tasks.py

示例9: _run_configure_command

# 需要导入模块: from invoke import Context [as 别名]
# 或者: from invoke.Context import run [as 别名]
    def _run_configure_command(
            self,
            ctx: Context,
            openssl_target: str,
            zlib_lib_path: Path,
            zlib_include_path: Path
    ) -> None:
        if self.platform in [SupportedPlatformEnum.WINDOWS_32, SupportedPlatformEnum.WINDOWS_64]:
            extra_args = '-no-asm -DZLIB_WINAPI'  # *hate* zlib
            # On Windows OpenSSL wants the full path to the lib file
            final_zlib_path = zlib_lib_path
        else:
            extra_args = ' -fPIC'
            # On Unix OpenSSL wants the path to the folder where the lib is
            final_zlib_path = zlib_lib_path.parent

        ctx.run(self._OPENSSL_CONF_CMD.format(
            target=openssl_target,
            zlib_lib_path=final_zlib_path,
            zlib_include_path=zlib_include_path,
            extra_args=extra_args
        ))
开发者ID:nabla-c0d3,项目名称:nassl,代码行数:24,代码来源:build_tasks.py

示例10: nesting_should_retain_order

# 需要导入模块: from invoke import Context [as 别名]
# 或者: from invoke.Context import run [as 别名]
        def nesting_should_retain_order(self, Local):
            runner = Local.return_value
            ctx = Context()
            with ctx.prefix('cd foo'):
                with ctx.prefix('cd bar'):
                    ctx.run('whoami')
                    cmd = "cd foo && cd bar && whoami"
                    ok_(runner.run.called, "run() never called runner.run()!")
                    eq_(runner.run.call_args[0][0], cmd)

                ctx.run('whoami')
                cmd = "cd foo && whoami"
                ok_(runner.run.called, "run() never called runner.run()!")
                eq_(runner.run.call_args[0][0], cmd)

            # also test that prefixes do not persist
            ctx.run('whoami')
            cmd = "whoami"
            ok_(runner.run.called, "run() never called runner.run()!")
            eq_(runner.run.call_args[0][0], cmd)
开发者ID:yws,项目名称:invoke,代码行数:22,代码来源:context.py

示例11: nesting_should_retain_order

# 需要导入模块: from invoke import Context [as 别名]
# 或者: from invoke.Context import run [as 别名]
        def nesting_should_retain_order(self, Local):
            runner = Local.return_value
            c = Context()
            with c.prefix('cd foo'):
                with c.prefix('cd bar'):
                    c.run('whoami')
                    cmd = "cd foo && cd bar && whoami"
                    assert runner.run.called, "run() never called runner.run()!" # noqa
                    assert runner.run.call_args[0][0] == cmd

                c.run('whoami')
                cmd = "cd foo && whoami"
                assert runner.run.called, "run() never called runner.run()!"
                assert runner.run.call_args[0][0] == cmd

            # also test that prefixes do not persist
            c.run('whoami')
            cmd = "whoami"
            assert runner.run.called, "run() never called runner.run()!"
            assert runner.run.call_args[0][0] == cmd
开发者ID:offbyone,项目名称:invoke,代码行数:22,代码来源:context.py

示例12: honors_runner_config_setting

# 需要导入模块: from invoke import Context [as 别名]
# 或者: from invoke.Context import run [as 别名]
 def honors_runner_config_setting(self):
     runner_class = Mock()
     config = Config({"runners": {"local": runner_class}})
     c = Context(config)
     c.run("foo")
     assert runner_class.mock_calls == [call(c), call().run("foo")]
开发者ID:miradam,项目名称:invoke,代码行数:8,代码来源:context.py

示例13: defaults_to_Local

# 需要导入模块: from invoke import Context [as 别名]
# 或者: from invoke.Context import run [as 别名]
 def defaults_to_Local(self, Local):
     c = Context()
     c.run("foo")
     assert Local.mock_calls == [call(c), call().run("foo")]
开发者ID:miradam,项目名称:invoke,代码行数:6,代码来源:context.py

示例14: _run_build_steps

# 需要导入模块: from invoke import Context [as 别名]
# 或者: from invoke.Context import run [as 别名]
 def _run_build_steps(self, ctx: Context) -> None:
     if self.platform in [SupportedPlatformEnum.WINDOWS_32, SupportedPlatformEnum.WINDOWS_64]:
         ctx.run('nmake clean', warn=True)
         ctx.run('nmake')
     else:
         return super()._run_build_steps(ctx)
开发者ID:nabla-c0d3,项目名称:nassl,代码行数:8,代码来源:build_tasks.py


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