當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。