Skip to content

Commit

Permalink
Handle setting expectations after removing steps.
Browse files Browse the repository at this point in the history
Fixes #2281.
  • Loading branch information
tomprince committed Apr 13, 2012
1 parent 790e4c9 commit 0653aab
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
7 changes: 4 additions & 3 deletions master/buildbot/status/progress.py
Expand Up @@ -150,9 +150,10 @@ def __init__(self, stepProgresses):
def setExpectationsFrom(self, exp):
"""Set our expectations from the builder's Expectations object."""
for name, metrics in exp.steps.items():
s = self.steps[name]
s.setExpectedTime(exp.times[name])
s.setExpectations(exp.steps[name])
s = self.steps.get(name)
if s:
s.setExpectedTime(exp.times[name])
s.setExpectations(exp.steps[name])

def newExpectations(self):
"""Call this when one of the steps has changed its expectations.
Expand Down
11 changes: 11 additions & 0 deletions master/buildbot/test/unit/test_status_progress.py
Expand Up @@ -30,3 +30,14 @@ def test_addNewStep(self):
stepProgress.finish()
stepProgress.setProgress("metric", 42)
expectations.update(newProgress)


def test_removeOldStep(self):
"""
http://trac.buildbot.net/ticket/2281
"""
stepProgress = progress.StepProgress("step", ["metric"])
oldProgress = progress.BuildProgress([stepProgress])
expectations = progress.Expectations(oldProgress)
buildProgress = progress.BuildProgress([])
buildProgress.setExpectationsFrom(expectations)

0 comments on commit 0653aab

Please sign in to comment.