本文整理汇总了Python中buildbot.process.base.Build类的典型用法代码示例。如果您正苦于以下问题:Python Build类的具体用法?Python Build怎么用?Python Build使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Build类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: testStopBuildWaitingForLocks
def testStopBuildWaitingForLocks(self):
r = FakeRequest()
b = Build([r])
b.setBuilder(Mock())
b.builder.botmaster = FakeMaster()
slavebuilder = Mock()
status = Mock()
l = SlaveLock('lock')
lock_access = l.access('counting')
l.access = lambda mode: lock_access
real_lock = b.builder.botmaster.getLockByID(l).getLock(slavebuilder)
b.setLocks([l])
step = Mock()
step.return_value = step
step.startStep.return_value = SUCCESS
b.setStepFactories([(step, {})])
real_lock.claim(Mock(), l.access('counting'))
def acquireLocks(res=None):
retval = Build.acquireLocks(b, res)
b.stopBuild('stop it')
return retval
b.acquireLocks = acquireLocks
b.startBuild(status, None, slavebuilder)
self.assert_( ('startStep', (b.remote,), {}) not in step.method_calls)
self.assert_(b.currentStep is None)
self.assertEqual(b.result, EXCEPTION)
self.assert_( ('interrupt', ('stop it',), {}) not in step.method_calls)
示例2: testStepDoneFail
def testStepDoneFail(self):
r = FakeRequest()
b = Build([r])
b.results = [SUCCESS]
b.result = SUCCESS
b.remote = Mock()
step = FakeBuildStep()
terminate = b.stepDone(FAILURE, step)
self.assertEqual(terminate, False)
self.assertEqual(b.result, FAILURE)
示例3: testStepDoneWarnings
def testStepDoneWarnings(self):
r = FakeRequest()
b = Build([r])
b.results = [SUCCESS]
b.result = SUCCESS
b.remote = Mock()
step = FakeBuildStep()
terminate = b.stepDone(WARNINGS, step)
self.assertEqual(terminate, False)
self.assertEqual(b.result, WARNINGS)
示例4: testStepDoneWarningsDontOverrideFailure
def testStepDoneWarningsDontOverrideFailure(self):
r = FakeRequest()
b = Build([r])
b.results = [FAILURE]
b.result = FAILURE
b.remote = Mock()
step = FakeBuildStep()
terminate = b.stepDone(WARNINGS, step)
self.assertEqual(terminate, False)
self.assertEqual(b.result, FAILURE)
示例5: testStepDoneFailOverridesWarnings
def testStepDoneFailOverridesWarnings(self):
r = FakeRequest()
b = Build([r])
b.results = [SUCCESS, WARNINGS]
b.result = WARNINGS
b.remote = Mock()
step = FakeBuildStep()
terminate = b.stepDone(FAILURE, step)
self.assertEqual(terminate, False)
self.assertEqual(b.result, FAILURE)
示例6: testBuildLocksAcquired
def testBuildLocksAcquired(self):
r = FakeRequest()
b = Build([r])
b.setBuilder(Mock())
b.builder.botmaster = FakeMaster()
slavebuilder = Mock()
status = Mock()
l = SlaveLock('lock')
claimCount = [0]
lock_access = l.access('counting')
l.access = lambda mode: lock_access
real_lock = b.builder.botmaster.getLockByID(l).getLock(slavebuilder)
def claim(owner, access):
claimCount[0] += 1
return real_lock.old_claim(owner, access)
real_lock.old_claim = real_lock.claim
real_lock.claim = claim
b.setLocks([l])
step = Mock()
step.return_value = step
step.startStep.return_value = SUCCESS
b.setStepFactories([(step, {})])
b.startBuild(status, None, slavebuilder)
self.assertEqual(b.result, SUCCESS)
self.assert_( ('startStep', (b.remote,), {}) in step.method_calls)
self.assertEquals(claimCount[0], 1)
示例7: testStepDoneHaltOnFailure
def testStepDoneHaltOnFailure(self):
r = FakeRequest()
b = Build([r])
b.results = []
b.result = SUCCESS
b.remote = Mock()
step = FakeBuildStep()
step.haltOnFailure = True
terminate = b.stepDone(FAILURE, step)
self.assertEqual(terminate, True)
self.assertEqual(b.result, FAILURE)
示例8: testStepDoneHaltOnFailureFlunkOnWarnings
def testStepDoneHaltOnFailureFlunkOnWarnings(self):
r = FakeRequest()
b = Build([r])
b.results = [SUCCESS]
b.result = SUCCESS
b.remote = Mock()
step = FakeBuildStep()
step.flunkOnWarnings = True
self.haltOnFailure = True
terminate = b.stepDone(WARNINGS, step)
self.assertEqual(terminate, False)
self.assertEqual(b.result, FAILURE)
示例9: testStepDoneWarnOnFailure
def testStepDoneWarnOnFailure(self):
r = FakeRequest()
b = Build([r])
b.results = [SUCCESS]
b.result = SUCCESS
b.remote = Mock()
step = FakeBuildStep()
step.warnOnFailure = True
step.flunkOnFailure = False
terminate = b.stepDone(FAILURE, step)
self.assertEqual(terminate, False)
self.assertEqual(b.result, WARNINGS)
示例10: makeBuildStep
def makeBuildStep(basedir, step_class=BuildStep, **kwargs):
bss = setupBuildStepStatus(basedir)
ss = SourceStamp()
setup = {'name': "builder1", "slavename": "bot1",
'builddir': "builddir", 'factory': None}
b0 = Builder(setup, bss.getBuild().getBuilder())
br = BuildRequest("reason", ss)
b = Build([br])
b.setBuilder(b0)
s = step_class(**kwargs)
s.setBuild(b)
s.setStepStatus(bss)
b.setupStatus(bss.getBuild())
s.slaveVersion = fake_slaveVersion
return s
示例11: testStopBuild
def testStopBuild(self):
r = FakeRequest()
b = Build([r])
b.setBuilder(Mock())
step = Mock()
step.return_value = step
b.setStepFactories([(step, {})])
slavebuilder = Mock()
status = Mock()
def startStep(*args, **kw):
# Now interrupt the build
b.stopBuild("stop it")
return defer.Deferred()
step.startStep = startStep
b.startBuild(status, None, slavebuilder)
self.assert_("Interrupted" in b.text)
self.assertEqual(b.result, FAILURE)
self.assert_( ('interrupt', ('stop it',), {}) in step.method_calls)
示例12: testStepDoneRetryOverridesAnythingElse
def testStepDoneRetryOverridesAnythingElse(self):
r = FakeRequest()
b = Build([r])
b.results = [RETRY]
b.result = RETRY
b.remote = Mock()
step = FakeBuildStep()
step.alwaysRun = True
b.stepDone(WARNINGS, step)
b.stepDone(FAILURE, step)
b.stepDone(SUCCESS, step)
terminate = b.stepDone(EXCEPTION, step)
self.assertEqual(terminate, True)
self.assertEqual(b.result, RETRY)
示例13: testRunSuccessfulBuild
def testRunSuccessfulBuild(self):
r = FakeRequest()
b = Build([r])
b.setBuilder(Mock())
step = Mock()
step.return_value = step
step.startStep.return_value = SUCCESS
b.setStepFactories([(step, {})])
slavebuilder = Mock()
status = Mock()
b.startBuild(status, None, slavebuilder)
self.assertEqual(b.result, SUCCESS)
self.assert_( ('startStep', (b.remote,), {}) in step.method_calls)
示例14: testStopBuildWaitingForStepLocks
def testStopBuildWaitingForStepLocks(self):
r = FakeRequest()
b = Build([r])
b.setBuilder(Mock())
b.builder.botmaster = FakeMaster()
slavebuilder = Mock()
status = Mock()
l = SlaveLock('lock')
claimCount = [0]
lock_access = l.access('counting')
l.access = lambda mode: lock_access
real_lock = b.builder.botmaster.getLockByID(l).getLock(slavebuilder)
step = LoggingBuildStep(locks=[lock_access])
def factory(*args):
return step
b.setStepFactories([(factory, {})])
real_lock.claim(Mock(), l.access('counting'))
gotLocks = [False]
def acquireLocks(res=None):
gotLocks[0] = True
retval = LoggingBuildStep.acquireLocks(step, res)
self.assert_(b.currentStep is step)
b.stopBuild('stop it')
return retval
step.acquireLocks = acquireLocks
step.setStepStatus = Mock()
step.step_status = Mock()
step.step_status.addLog().chunkSize = 10
step.step_status.getLogs.return_value = []
b.startBuild(status, None, slavebuilder)
self.assertEqual(gotLocks, [True])
self.assert_(('stepStarted', (), {}) in step.step_status.method_calls)
self.assert_("Interrupted" in b.text, b.text)
self.assertEqual(b.result, FAILURE)
示例15: makeBuildStep
def makeBuildStep(basedir, step_class=BuildStep, **kwargs):
bss = setupBuildStepStatus(basedir)
ss = SourceStamp()
setup = {"name": "builder1", "slavename": "bot1", "builddir": "builddir", "factory": None}
b0 = Builder(setup, bss.getBuild().getBuilder())
b0.botmaster = FakeBotMaster()
br = BuildRequest("reason", ss, "test_builder")
b = Build([br])
b.setBuilder(b0)
s = step_class(**kwargs)
s.setBuild(b)
s.setStepStatus(bss)
b.build_status = bss.getBuild()
b.setupProperties()
s.slaveVersion = fake_slaveVersion
return s