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