? buildbot/test/__init__.pyc
? buildbot/test/test_bonsaipoller.pyc
RCS file: /cvsroot/mozilla/tools/buildbot/buildbot/test/test_bonsaipoller.py,v
retrieving revision 1.3
diff -u -r1.3 test_bonsaipoller.py
|
|
|
|
| 5 | 5 | BonsaiParser, BonsaiPoller, InvalidResultError, EmptyResult |
| 6 | 6 | from buildbot.changes.changes import ChangeMaster |
| 7 | 7 | |
| 8 | | from StringIO import StringIO |
| 9 | 8 | from copy import deepcopy |
| 10 | 9 | import re |
| 11 | 10 | |
| … |
… |
|
| 123 | 122 | |
| 124 | 123 | class TestBonsaiPoller(unittest.TestCase): |
| 125 | 124 | def testFullyFormedResult(self): |
| 126 | | br = BonsaiParser(StringIO(goodUnparsedResult)) |
| | 125 | br = BonsaiParser(goodUnparsedResult) |
| 127 | 126 | result = br.getData() |
| 128 | 127 | # make sure the result is a BonsaiResult |
| 129 | 128 | self.failUnless(isinstance(result, BonsaiResult)) |
| … |
… |
|
| 133 | 132 | |
| 134 | 133 | def testBadUnparsedResult(self): |
| 135 | 134 | try: |
| 136 | | BonsaiParser(StringIO(badUnparsedResult)) |
| | 135 | BonsaiParser(badUnparsedResult) |
| 137 | 136 | self.fail(badResultMsgs["badUnparsedResult"]) |
| 138 | 137 | except InvalidResultError: |
| 139 | 138 | pass |
| 140 | 139 | |
| 141 | 140 | def testInvalidDateResult(self): |
| 142 | 141 | try: |
| 143 | | BonsaiParser(StringIO(invalidDateResult)) |
| | 142 | BonsaiParser(invalidDateResult) |
| 144 | 143 | self.fail(badResultMsgs["invalidDateResult"]) |
| 145 | 144 | except InvalidResultError: |
| 146 | 145 | pass |
| 147 | 146 | |
| 148 | 147 | def testMissingFilenameResult(self): |
| 149 | 148 | try: |
| 150 | | BonsaiParser(StringIO(missingFilenameResult)) |
| | 149 | BonsaiParser(missingFilenameResult) |
| 151 | 150 | self.fail(badResultMsgs["missingFilenameResult"]) |
| 152 | 151 | except InvalidResultError: |
| 153 | 152 | pass |
| 154 | 153 | |
| 155 | 154 | def testDuplicateLogResult(self): |
| 156 | 155 | try: |
| 157 | | BonsaiParser(StringIO(duplicateLogResult)) |
| | 156 | BonsaiParser(duplicateLogResult) |
| 158 | 157 | self.fail(badResultMsgs["duplicateLogResult"]) |
| 159 | 158 | except InvalidResultError: |
| 160 | 159 | pass |
| 161 | 160 | |
| 162 | 161 | def testDuplicateFilesResult(self): |
| 163 | 162 | try: |
| 164 | | BonsaiParser(StringIO(duplicateFilesResult)) |
| | 163 | BonsaiParser(duplicateFilesResult) |
| 165 | 164 | self.fail(badResultMsgs["duplicateFilesResult"]) |
| 166 | 165 | except InvalidResultError: |
| 167 | 166 | pass |
| 168 | 167 | |
| 169 | 168 | def testMissingCiResult(self): |
| 170 | 169 | try: |
| 171 | | BonsaiParser(StringIO(missingCiResult)) |
| | 170 | BonsaiParser(missingCiResult) |
| 172 | 171 | self.fail(badResultMsgs["missingCiResult"]) |
| 173 | 172 | except EmptyResult: |
| 174 | 173 | pass |
| … |
… |
|
| 177 | 176 | "Make sure a change is not submitted if the BonsaiParser fails" |
| 178 | 177 | poller = FakeBonsaiPoller() |
| 179 | 178 | lastChangeBefore = poller.lastChange |
| 180 | | poller._process_changes(StringIO(badUnparsedResult)) |
| | 179 | poller._process_changes(badUnparsedResult) |
| 181 | 180 | # self.lastChange will not be updated if the change was not submitted |
| 182 | 181 | self.failUnlessEqual(lastChangeBefore, poller.lastChange) |
| 183 | 182 | |
| … |
… |
|
| 189 | 188 | |
| 190 | 189 | lastChangeBefore = poller.lastChange |
| 191 | 190 | # generate an exception first |
| 192 | | poller._process_changes(StringIO(badUnparsedResult)) |
| | 191 | poller._process_changes(badUnparsedResult) |
| 193 | 192 | # now give it a valid one... |
| 194 | | poller._process_changes(StringIO(goodUnparsedResult)) |
| | 193 | poller._process_changes(goodUnparsedResult) |
| 195 | 194 | # if poller.lastChange has not been updated then the good result |
| 196 | 195 | # was not parsed |
| 197 | 196 | self.failIfEqual(lastChangeBefore, poller.lastChange) |