[Buildbot-commits] buildbot/buildbot/test test_bonsaipoller.py, 1.4, 1.5
Brian Warner
warner at users.sourceforge.net
Tue Apr 29 20:21:29 UTC 2008
Update of /cvsroot/buildbot/buildbot/buildbot/test
In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv30745/buildbot/test
Modified Files:
test_bonsaipoller.py
Log Message:
[project @ bonsaipoller: apply fixes from Ben Hearsum, closes #216]
Original author: warner at lothar.com
Date: 2008-04-29 16:21:08+00:00
Index: test_bonsaipoller.py
===================================================================
RCS file: /cvsroot/buildbot/buildbot/buildbot/test/test_bonsaipoller.py,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- test_bonsaipoller.py 29 Sep 2007 22:51:40 -0000 1.4
+++ test_bonsaipoller.py 29 Apr 2008 20:21:27 -0000 1.5
@@ -3,6 +3,7 @@
from twisted.trial import unittest
from buildbot.changes.bonsaipoller import FileNode, CiNode, BonsaiResult, \
BonsaiParser, BonsaiPoller, InvalidResultError, EmptyResult
+from buildbot.changes.changes import ChangeMaster
from copy import deepcopy
import re
@@ -73,9 +74,6 @@
invalidDateResult = deepcopy(goodUnparsedResult)
invalidDateResult = invalidDateResult.replace(str(date1), "foobar")
-missingRevisionResult = deepcopy(goodUnparsedResult)
-missingRevisionResult = missingRevisionResult.replace("rev=\""+rev3+"\"", "")
-
missingFilenameResult = deepcopy(goodUnparsedResult)
missingFilenameResult = missingFilenameResult.replace(file2, "")
@@ -140,9 +138,17 @@
dict(filename="third/file.ext",
revision="1.3")]
+class FakeChangeMaster(ChangeMaster):
+ def __init__(self):
+ ChangeMaster.__init__(self)
+
+ def addChange(self, change):
+ pass
+
class FakeBonsaiPoller(BonsaiPoller):
def __init__(self):
BonsaiPoller.__init__(self, "fake url", "fake module", "fake branch")
+ self.parent = FakeChangeMaster()
class TestBonsaiPoller(unittest.TestCase):
def testFullyFormedResult(self):
@@ -168,13 +174,6 @@
except InvalidResultError:
pass
- def testMissingRevisionResult(self):
- try:
- BonsaiParser(missingRevisionResult)
- self.fail(badResultMsgs["missingRevisionResult"])
- except InvalidResultError:
- pass
-
def testMissingFilenameResult(self):
try:
BonsaiParser(missingFilenameResult)
@@ -211,6 +210,21 @@
# self.lastChange will not be updated if the change was not submitted
self.failUnlessEqual(lastChangeBefore, poller.lastChange)
+ def testParserWorksAfterInvalidResult(self):
+ """Make sure the BonsaiPoller still works after catching an
+ InvalidResultError"""
+
+ poller = FakeBonsaiPoller()
+
+ lastChangeBefore = poller.lastChange
+ # generate an exception first
+ poller._process_changes(badUnparsedResult)
+ # now give it a valid one...
+ poller._process_changes(goodUnparsedResult)
+ # if poller.lastChange has not been updated then the good result
+ # was not parsed
+ self.failIfEqual(lastChangeBefore, poller.lastChange)
+
def testMergeEmptyLogMsg(self):
"""Ensure that BonsaiPoller works around the bonsai xml output
issue when the check-in comment is empty"""
More information about the Commits
mailing list