forked from buildbot/buildbot
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move setText out of setStepStatus into startStep.
When called in setStepStatus, properties for commands may not yet be set, and so KeyError exceptions are raised. setText must be called before stepStarted is called, so that status receivers see the proper description.
- Loading branch information
Chris AtLee
committed
Mar 4, 2010
1 parent
c76b704
commit 3696fad
Showing
6 changed files
with
68 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
60 changes: 60 additions & 0 deletions
60
buildbot/test/regressions/test_shell_command_properties.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
from twisted.trial import unittest | ||
|
||
from buildbot.steps.shell import ShellCommand, SetProperty | ||
from buildbot.process.properties import WithProperties, Properties | ||
from buildbot.process.factory import BuildFactory | ||
from buildbot.buildrequest import BuildRequest | ||
from buildbot.sourcestamp import SourceStamp | ||
|
||
class FakeSlaveBuilder: | ||
slave = None | ||
|
||
class FakeBuildStatus: | ||
def __init__(self): | ||
self.names = [] | ||
|
||
def addStepWithName(self, name): | ||
self.names.append(name) | ||
return FakeStepStatus() | ||
|
||
def getProperties(self): | ||
return Properties() | ||
|
||
def setSourceStamp(self, ss): | ||
self.ss = ss | ||
|
||
def setReason(self, reason): | ||
self.reason = reason | ||
|
||
def setBlamelist(self, bl): | ||
self.bl = bl | ||
|
||
def setProgress(self, p): | ||
self.progress = p | ||
|
||
|
||
class FakeStepStatus: | ||
txt = None | ||
def setText(self, txt): | ||
self.txt = txt | ||
|
||
def setProgress(self, sp): | ||
pass | ||
|
||
|
||
class TestShellCommandProperties(unittest.TestCase): | ||
def testCommand(self): | ||
f = BuildFactory() | ||
f.addStep(SetProperty(command=["echo", "value"], property="propname")) | ||
f.addStep(ShellCommand(command=["echo", WithProperties("%(propname)s")])) | ||
|
||
ss = SourceStamp() | ||
|
||
req = BuildRequest("Testing", ss, None) | ||
|
||
b = f.newBuild([req]) | ||
b.build_status = FakeBuildStatus() | ||
b.slavebuilder = FakeSlaveBuilder() | ||
|
||
# This shouldn't raise an exception | ||
b.setupBuild(None) |