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


Python ShellCommand.start方法代码示例

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


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

示例1: testNoStderr

# 需要导入模块: from buildbot.slave.commands.base import ShellCommand [as 别名]
# 或者: from buildbot.slave.commands.base.ShellCommand import start [as 别名]
    def testNoStderr(self):
        basedir = "test_slave_commands_base.shellcommand.nostderr"
        b = FakeSlaveBuilder(False, basedir)
        s = ShellCommand(b, [sys.executable, '-c', 'import sys; sys.stderr.write("hello\\n")'], basedir, sendStderr=False)

        d = s.start()
        def check(ign):
            self.failIf({'stderr': 'hello\n'} in b.updates)
            self.failUnless({'rc': 0} in b.updates)
        d.addCallback(check)
        return d
开发者ID:centrumholdings,项目名称:buildbot,代码行数:13,代码来源:test_slave_commands_base.py

示例2: testNoStdout

# 需要导入模块: from buildbot.slave.commands.base import ShellCommand [as 别名]
# 或者: from buildbot.slave.commands.base.ShellCommand import start [as 别名]
    def testNoStdout(self):
        basedir = "test_slave_commands_base.shellcommand.nostdout"
        b = FakeSlaveBuilder(False, basedir)
        s = ShellCommand(b, stdoutCommand('hello'), basedir, sendStdout=False)

        d = s.start()
        def check(ign):
            self.failIf({'stdout': 'hello\n'} in b.updates)
            self.failUnless({'rc': 0} in b.updates)
        d.addCallback(check)
        return d
开发者ID:centrumholdings,项目名称:buildbot,代码行数:13,代码来源:test_slave_commands_base.py

示例3: testNoLogEnviron

# 需要导入模块: from buildbot.slave.commands.base import ShellCommand [as 别名]
# 或者: from buildbot.slave.commands.base.ShellCommand import start [as 别名]
    def testNoLogEnviron(self):
        basedir = "test_slave_commands_base.shellcommand.start"
        b = FakeSlaveBuilder(False, basedir)
        s = ShellCommand(b, stdoutCommand('hello'), basedir, environ={"FOO": "BAR"}, logEnviron=False)

        d = s.start()
        def check(ign):
            headers = "".join([update.values()[0] for update in b.updates if update.keys() == ["header"] ])
            self.failUnless("FOO=BAR\n" not in headers)
        d.addCallback(check)
        return d
开发者ID:centrumholdings,项目名称:buildbot,代码行数:13,代码来源:test_slave_commands_base.py

示例4: testUnsetEnvironVar

# 需要导入模块: from buildbot.slave.commands.base import ShellCommand [as 别名]
# 或者: from buildbot.slave.commands.base.ShellCommand import start [as 别名]
    def testUnsetEnvironVar(self):
        basedir = "test_slave_commands_base.shellcommand.start"
        b = FakeSlaveBuilder(False, basedir)
        s = ShellCommand(b, stdoutCommand('hello'), basedir, environ={"PATH":None})

        d = s.start()
        def check(ign):
            headers = "".join([update.values()[0] for update in b.updates if update.keys() == ["header"] ])
            self.failUnless(not re.match('\bPATH=',headers))
        d.addCallback(check)
        return d
开发者ID:centrumholdings,项目名称:buildbot,代码行数:13,代码来源:test_slave_commands_base.py

示例5: testStringCommand

# 需要导入模块: from buildbot.slave.commands.base import ShellCommand [as 别名]
# 或者: from buildbot.slave.commands.base.ShellCommand import start [as 别名]
    def testStringCommand(self):
        basedir = "test_slave_commands_base.shellcommand.string"
        b = FakeSlaveBuilder(False, basedir)
        s = ShellCommand(b, 'echo hello', basedir)

        d = s.start()
        def check(ign):
            self.failUnless({'stdout': 'hello\n'} in b.updates)
            self.failUnless({'rc': 0} in b.updates)
        d.addCallback(check)
        return d
开发者ID:centrumholdings,项目名称:buildbot,代码行数:13,代码来源:test_slave_commands_base.py

示例6: testBadCommand

# 需要导入模块: from buildbot.slave.commands.base import ShellCommand [as 别名]
# 或者: from buildbot.slave.commands.base.ShellCommand import start [as 别名]
 def testBadCommand(self):
     basedir = "test_slave_commands_base.shellcommand.badcommand"
     b = FakeSlaveBuilder(False, basedir)
     s = ShellCommand(b, ['command_that_doesnt_exist.exe'], basedir)
     s.workdir = 1
     d = s.start()
     def check(err):
         self.flushLoggedErrors()
         err.trap(AbandonChain)
     d.addBoth(check)
     return d
开发者ID:brasse,项目名称:buildbot,代码行数:13,代码来源:test_slave_commands_base.py

示例7: testKeepStdout

# 需要导入模块: from buildbot.slave.commands.base import ShellCommand [as 别名]
# 或者: from buildbot.slave.commands.base.ShellCommand import start [as 别名]
    def testKeepStdout(self):
        basedir = "test_slave_commands_base.shellcommand.keepstdout"
        b = FakeSlaveBuilder(False, basedir)
        s = ShellCommand(b, stdoutCommand('hello'), basedir, keepStdout=True)

        d = s.start()
        def check(ign):
            self.failUnless({'stdout': 'hello\n'} in b.updates)
            self.failUnless({'rc': 0} in b.updates)
            self.failUnlessEquals(s.stdout, 'hello\n')
        d.addCallback(check)
        return d
开发者ID:centrumholdings,项目名称:buildbot,代码行数:14,代码来源:test_slave_commands_base.py

示例8: testCommandMaxTime

# 需要导入模块: from buildbot.slave.commands.base import ShellCommand [as 别名]
# 或者: from buildbot.slave.commands.base.ShellCommand import start [as 别名]
 def testCommandMaxTime(self):
     basedir = "test_slave_commands_base.shellcommand.maxtime"
     b = FakeSlaveBuilder(False, basedir)
     s = ShellCommand(b, 'sleep 10; echo hello', basedir, maxTime=5)
     clock = task.Clock()
     s._reactor = clock
     d = s.start()
     def check(ign):
         self.failUnless({'stdout': 'hello\n'} not in b.updates)
         self.failUnless({'rc': -1} in b.updates, b.updates)
     d.addCallback(check)
     clock.advance(6)
     return d
开发者ID:centrumholdings,项目名称:buildbot,代码行数:15,代码来源:test_slave_commands_base.py

示例9: testEnvironExpandVar

# 需要导入模块: from buildbot.slave.commands.base import ShellCommand [as 别名]
# 或者: from buildbot.slave.commands.base.ShellCommand import start [as 别名]
    def testEnvironExpandVar(self):
        basedir = "test_slave_commands_base.shellcommand.start"
        b = FakeSlaveBuilder(False, basedir)
        environ = {"EXPND": "-${PATH}-",
                   "DOESNT_EXPAND": "-${---}-",
                   "DOESNT_FIND": "-${DOESNT_EXISTS}-"}
        s = ShellCommand(b, stdoutCommand('hello'), basedir, environ=environ)

        d = s.start()
        def check(ign):
            headers = "".join([update.values()[0] for update in b.updates if update.keys() == ["header"] ])
            self.failUnless("EXPND=-$" not in headers)
            self.failUnless("DOESNT_FIND=--\n" in headers)
            self.failUnless("DOESNT_EXPAND=-${---}-\n"  in headers)
        d.addCallback(check)
        return d
开发者ID:centrumholdings,项目名称:buildbot,代码行数:18,代码来源:test_slave_commands_base.py

示例10: testBadCommand

# 需要导入模块: from buildbot.slave.commands.base import ShellCommand [as 别名]
# 或者: from buildbot.slave.commands.base.ShellCommand import start [as 别名]
 def testBadCommand(self):
     basedir = "test_slave_commands_base.shellcommand.badcommand"
     b = FakeSlaveBuilder(False, basedir)
     s = ShellCommand(b, ['command_that_doesnt_exist.exe'], basedir)
     s.workdir = 1
     d = s.start()
     def check(err):
         self.flushLoggedErrors()
         err.trap(AbandonChain)
         stderr = []
         # Here we're checking that the exception starting up the command
         # actually gets propogated back to the master.
         for u in b.updates:
             if 'stderr' in u:
                 stderr.append(u['stderr'])
         stderr = "".join(stderr)
         self.failUnless("TypeError" in stderr, stderr)
     d.addBoth(check)
     return d
开发者ID:centrumholdings,项目名称:buildbot,代码行数:21,代码来源:test_slave_commands_base.py


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