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


Python base.ShellCommand类代码示例

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


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

示例1: testSendNotimeout

 def testSendNotimeout(self):
     basedir = "test_slave_commands_base.logging.sendNotimeout"
     b = FakeSlaveBuilder(False, basedir)
     s = ShellCommand(b, stdoutCommand('hello'), basedir)
     data = "x" * (ShellCommand.BUFFER_SIZE + 1)
     s._addToBuffers('stdout', data)
     self.failUnless(len(b.updates), 1)
开发者ID:centrumholdings,项目名称:buildbot,代码行数:7,代码来源:test_slave_commands_base.py

示例2: testSendChunked

 def testSendChunked(self):
     basedir = "test_slave_commands_base.logging.sendBufferedChunked"
     b = FakeSlaveBuilder(False, basedir)
     s = ShellCommand(b, stdoutCommand('hello'), basedir)
     data = "x" * ShellCommand.CHUNK_LIMIT * 2
     s._addToBuffers('stdout', data)
     s._sendBuffers()
     self.failUnless(len(b.updates), 2)
开发者ID:centrumholdings,项目名称:buildbot,代码行数:8,代码来源:test_slave_commands_base.py

示例3: testNoStderr

    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,代码行数:11,代码来源:test_slave_commands_base.py

示例4: testNoStdout

    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,代码行数:11,代码来源:test_slave_commands_base.py

示例5: testNoLogEnviron

    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,代码行数:11,代码来源:test_slave_commands_base.py

示例6: testUnsetEnvironVar

    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,代码行数:11,代码来源:test_slave_commands_base.py

示例7: testStringCommand

    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,代码行数:11,代码来源:test_slave_commands_base.py

示例8: testBadCommand

 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,代码行数:11,代码来源:test_slave_commands_base.py

示例9: testKeepStdout

    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,代码行数:12,代码来源:test_slave_commands_base.py

示例10: testCommandMaxTime

 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,代码行数:13,代码来源:test_slave_commands_base.py

示例11: testEnvironExpandVar

    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,代码行数:16,代码来源:test_slave_commands_base.py

示例12: testSendBufferedInterleaved

 def testSendBufferedInterleaved(self):
     basedir = "test_slave_commands_base.logging.sendBufferedInterleaved"
     b = FakeSlaveBuilder(False, basedir)
     s = ShellCommand(b, stdoutCommand('hello'), basedir)
     s._addToBuffers('stdout', 'hello ')
     s._addToBuffers('stderr', 'DIEEEEEEE')
     s._addToBuffers('stdout', 'world')
     s._sendBuffers()
     self.failUnlessEqual(b.updates, [
         {'stdout': 'hello '},
         {'stderr': 'DIEEEEEEE'},
         {'stdout': 'world'},
         ])
开发者ID:centrumholdings,项目名称:buildbot,代码行数:13,代码来源:test_slave_commands_base.py

示例13: testBadCommand

 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,代码行数:19,代码来源:test_slave_commands_base.py

示例14: testSendStatus

 def testSendStatus(self):
     basedir = "test_slave_commands_base.logging.sendStatus"
     b = FakeSlaveBuilder(False, basedir)
     s = ShellCommand(b, stdoutCommand('hello'), basedir)
     s.sendStatus({'stdout': 'hello\n'})
     self.failUnlessEqual(b.updates, [{'stdout': 'hello\n'}])
开发者ID:centrumholdings,项目名称:buildbot,代码行数:6,代码来源:test_slave_commands_base.py


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