OLD | NEW |
---|---|
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 import test_env # pylint: disable=W0611 | 6 import test_env # pylint: disable=W0611 |
7 import unittest | 7 import unittest |
8 import mock | 8 import mock |
9 | 9 |
10 from buildbot.status.builder import FAILURE, SUCCESS | 10 from buildbot.status.builder import FAILURE, SUCCESS |
(...skipping 28 matching lines...) Expand all Loading... | |
39 TEST_STATUS_MULTI_IMPROVE = ( | 39 TEST_STATUS_MULTI_IMPROVE = ( |
40 'media_tests_av_perf <div class="BuildResultInfo"> PERF_IMPROVE: time/t ' | 40 'media_tests_av_perf <div class="BuildResultInfo"> PERF_IMPROVE: time/t ' |
41 '(89.07%), fps/video (5.40%), fps/video2 (5.40%) </div>') | 41 '(89.07%), fps/video (5.40%), fps/video2 (5.40%) </div>') |
42 | 42 |
43 TEST_STATUS_MULTI_REGRESS_IMPROVE = ( | 43 TEST_STATUS_MULTI_REGRESS_IMPROVE = ( |
44 'media_tests_av_perf <div class="BuildResultInfo"> PERF_REGRESS: time/t ' | 44 'media_tests_av_perf <div class="BuildResultInfo"> PERF_REGRESS: time/t ' |
45 '(89.07%), fps/video (5.40%), fps/video2 (5.40%) PERF_IMPROVE: cpu/t ' | 45 '(89.07%), fps/video (5.40%), fps/video2 (5.40%) PERF_IMPROVE: cpu/t ' |
46 '(44.07%), cpu/t2 (3.0%) </div>') | 46 '(44.07%), cpu/t2 (3.0%) </div>') |
47 | 47 |
48 | 48 |
49 def getBuildStatusMock(name): | |
50 """Mocks a build status with a name as the parameter.""" | |
51 build_status = mock.Mock() | |
52 build_status.getName.return_value = name | |
53 build_status.getSourceStamp.return_value = None | |
54 build_status.getResponsibleUsers.return_value = '' | |
55 build_status.getChanges.return_value = '' | |
56 return build_status | |
57 | |
cmp
2012/10/22 18:39:16
insert an empty line here
shadi1
2012/10/23 00:11:16
Done.
| |
49 class PerfCountNotifierTest(unittest.TestCase): | 58 class PerfCountNotifierTest(unittest.TestCase): |
50 | 59 |
51 def setUp(self): | 60 def setUp(self): |
52 self.email_sent = False | 61 self.email_sent = False |
53 self.notifier = PerfCountNotifier( | 62 self.notifier = PerfCountNotifier( |
54 fromaddr='buildbot@test', | 63 fromaddr='buildbot@test', |
55 forgiving_steps=[], | 64 forgiving_steps=[], |
56 lookup='test', | 65 lookup='test', |
57 sendToInterestedUsers=False, | 66 sendToInterestedUsers=False, |
58 extraRecipients=['extra@test'], | 67 extraRecipients=['extra@test'], |
(...skipping 10 matching lines...) Expand all Loading... | |
69 self.old_getName = ChromiumNotifier.getName | 78 self.old_getName = ChromiumNotifier.getName |
70 ChromiumNotifier.getName = self.getNameMock | 79 ChromiumNotifier.getName = self.getNameMock |
71 | 80 |
72 def resetMockDefaultFunctions(self): | 81 def resetMockDefaultFunctions(self): |
73 ChromiumNotifier.getName = self.old_getName | 82 ChromiumNotifier.getName = self.old_getName |
74 | 83 |
75 def getNameMock(self, step_status): | 84 def getNameMock(self, step_status): |
76 """Mocks the getName which returns the build_status step name.""" | 85 """Mocks the getName which returns the build_status step name.""" |
77 return self.notifier.step_names[0] | 86 return self.notifier.step_names[0] |
78 | 87 |
88 def getResultCount(self, result_name): | |
89 """Returns the number of times result_name has been stored.""" | |
90 return self.notifier.recent_results.GetCount(result_name) | |
91 | |
79 def testSuccessIsNotInteresting(self): | 92 def testSuccessIsNotInteresting(self): |
80 """Test success step is not interesting.""" | 93 """Test success step is not interesting.""" |
81 build_status = None | 94 build_status = getBuildStatusMock('test_build') |
82 step_status = BuildStepStatusMock(TEST_STATUS_TEXT) | 95 step_status = BuildStepStatusMock(TEST_STATUS_TEXT) |
83 results = [SUCCESS] | 96 results = [SUCCESS] |
84 for _ in range(self.notifier.minimum_count): | 97 for _ in range(self.notifier.minimum_count): |
85 self.assertFalse(self.notifier.isInterestingStep( | 98 self.assertFalse(self.notifier.isInterestingStep( |
86 build_status, step_status, results)) | 99 build_status, step_status, results)) |
87 | 100 |
88 def testIsInterestingAfterMinimumResults(self): | 101 def testIsInterestingAfterMinimumResults(self): |
89 """Test step is interesting only after minimum consecutive results.""" | 102 """Test step is interesting only after minimum consecutive results.""" |
90 build_status = None | 103 build_status = getBuildStatusMock('test_build') |
91 step_status = BuildStepStatusMock(TEST_STATUS_TEXT) | 104 step_status = BuildStepStatusMock(TEST_STATUS_TEXT) |
92 results = [FAILURE] | 105 results = [FAILURE] |
93 for _ in range(self.notifier.minimum_count - 1): | 106 for _ in range(self.notifier.minimum_count - 1): |
94 self.assertFalse(self.notifier.isInterestingStep( | 107 self.assertFalse(self.notifier.isInterestingStep( |
95 build_status, step_status, results)) | 108 build_status, step_status, results)) |
96 self.assertTrue(self.notifier.isInterestingStep( | 109 self.assertTrue(self.notifier.isInterestingStep( |
97 build_status, step_status, results)) | 110 build_status, step_status, results)) |
98 | 111 |
99 def testIsInterestingResetByCounterResults(self): | 112 def testIsInterestingResetByCounterResults(self): |
100 """Test step is not interesting if a counter result appears.""" | 113 """Test step is not interesting if a counter result appears.""" |
101 build_status = None | 114 build_status = getBuildStatusMock('test_build') |
102 step_status = BuildStepStatusMock(TEST_STATUS_TEXT) | 115 step_status = BuildStepStatusMock(TEST_STATUS_TEXT) |
103 results = [FAILURE] | 116 results = [FAILURE] |
104 for _ in range(self.notifier.minimum_count - 1): | 117 for _ in range(self.notifier.minimum_count - 1): |
105 self.assertFalse(self.notifier.isInterestingStep( | 118 self.assertFalse(self.notifier.isInterestingStep( |
106 build_status, step_status, results)) | 119 build_status, step_status, results)) |
107 # Reset the counters by having counter results. | 120 # Reset the counters by having counter results. |
108 step_status = BuildStepStatusMock(TEST_STATUS_TEXT_COUNTER) | 121 step_status = BuildStepStatusMock(TEST_STATUS_TEXT_COUNTER) |
109 self.assertFalse(self.notifier.isInterestingStep( | 122 self.assertFalse(self.notifier.isInterestingStep( |
110 build_status, step_status, results)) | 123 build_status, step_status, results)) |
111 # Now check that we need to count back from the start. | 124 # Now check that we need to count back from the start. |
112 step_status = BuildStepStatusMock(TEST_STATUS_TEXT) | 125 step_status = BuildStepStatusMock(TEST_STATUS_TEXT) |
113 for _ in range(self.notifier.minimum_count - 1): | 126 for _ in range(self.notifier.minimum_count - 1): |
114 self.assertFalse(self.notifier.isInterestingStep( | 127 self.assertFalse(self.notifier.isInterestingStep( |
115 build_status, step_status, results)) | 128 build_status, step_status, results)) |
116 self.assertTrue(self.notifier.isInterestingStep( | 129 self.assertTrue(self.notifier.isInterestingStep( |
117 build_status, step_status, results)) | 130 build_status, step_status, results)) |
118 | 131 |
119 def testIsInterestingResetBySuccess(self): | 132 def testIsInterestingResetBySuccess(self): |
120 """Test step count reset after a successful pass.""" | 133 """Test step count reset after a successful pass.""" |
121 build_status = None | 134 build_status = getBuildStatusMock('test_build') |
122 step_status = BuildStepStatusMock(TEST_STATUS_TEXT) | 135 step_status = BuildStepStatusMock(TEST_STATUS_TEXT) |
123 results = [FAILURE] | 136 results = [FAILURE] |
124 for _ in range(self.notifier.minimum_count - 1): | 137 for _ in range(self.notifier.minimum_count - 1): |
125 self.assertFalse(self.notifier.isInterestingStep( | 138 self.assertFalse(self.notifier.isInterestingStep( |
126 build_status, step_status, results)) | 139 build_status, step_status, results)) |
127 # Reset the counters by having a success step. | 140 # Reset the counters by having a success step. |
128 results = [SUCCESS] | 141 results = [SUCCESS] |
129 self.assertFalse(self.notifier.isInterestingStep( | 142 self.assertFalse(self.notifier.isInterestingStep( |
130 build_status, step_status, results)) | 143 build_status, step_status, results)) |
131 # Now check that we need to count back from the start. | 144 # Now check that we need to count back from the start. |
132 results = [1] | 145 results = [1] |
133 for _ in range(self.notifier.minimum_count - 1): | 146 for _ in range(self.notifier.minimum_count - 1): |
134 self.assertFalse(self.notifier.isInterestingStep( | 147 self.assertFalse(self.notifier.isInterestingStep( |
135 build_status, step_status, results)) | 148 build_status, step_status, results)) |
136 self.assertTrue(self.notifier.isInterestingStep( | 149 self.assertTrue(self.notifier.isInterestingStep( |
137 build_status, step_status, results)) | 150 build_status, step_status, results)) |
138 | 151 |
139 def testIsInterestingException(self): | 152 def testIsInterestingException(self): |
140 """Test step is interesting when step has exception.""" | 153 """Test step is interesting when step has exception.""" |
141 build_status = None | 154 build_status = getBuildStatusMock('test_build') |
142 step_status = BuildStepStatusMock(TEST_STATUS_TEXT_EXCEPTION) | 155 step_status = BuildStepStatusMock(TEST_STATUS_TEXT_EXCEPTION) |
143 results = [FAILURE] | 156 results = [FAILURE] |
144 self.assertTrue(self.notifier.isInterestingStep( | 157 self.assertTrue(self.notifier.isInterestingStep( |
145 build_status, step_status, results)) | 158 build_status, step_status, results)) |
146 | 159 |
147 def testNotificationOnce(self): | 160 def testNotificationOnce(self): |
148 """Test isInsteresting happens only once.""" | 161 """Test isInsteresting happens only once.""" |
149 build_status = None | 162 build_status = getBuildStatusMock('test_build') |
150 step_status = BuildStepStatusMock(TEST_STATUS_TEXT) | 163 step_status = BuildStepStatusMock(TEST_STATUS_TEXT) |
151 results = [FAILURE] | 164 results = [FAILURE] |
152 for _ in range(self.notifier.minimum_count - 1): | 165 for _ in range(self.notifier.minimum_count - 1): |
153 self.assertFalse(self.notifier.isInterestingStep( | 166 self.assertFalse(self.notifier.isInterestingStep( |
154 build_status, step_status, results)) | 167 build_status, step_status, results)) |
155 self.assertTrue(self.notifier.isInterestingStep( | 168 self.assertTrue(self.notifier.isInterestingStep( |
156 build_status, step_status, results)) | 169 build_status, step_status, results)) |
157 self.assertFalse(self.notifier.isInterestingStep( | 170 self.assertFalse(self.notifier.isInterestingStep( |
158 build_status, step_status, results)) | 171 build_status, step_status, results)) |
159 # Force expiration of notifications | 172 # Force expiration of notifications |
160 self.notifier.notifications.expiration_time = -1 | 173 self.notifier.notifications.expiration_time = -1 |
161 self.assertTrue(self.notifier.isInterestingStep( | 174 self.assertTrue(self.notifier.isInterestingStep( |
162 build_status, step_status, results)) | 175 build_status, step_status, results)) |
163 | 176 |
164 def testIsInterestingResetByOtherResults(self): | 177 def testIsInterestingResetByOtherResults(self): |
165 """Test isInsteresting resets after different results appear.""" | 178 """Test isInsteresting resets after different results appear.""" |
166 build_status = None | 179 build_status = getBuildStatusMock('test_build') |
167 step_status = BuildStepStatusMock(TEST_STATUS_TEXT) | 180 step_status = BuildStepStatusMock(TEST_STATUS_TEXT) |
168 results = [FAILURE] | 181 results = [FAILURE] |
169 for _ in range(self.notifier.minimum_count - 1): | 182 for _ in range(self.notifier.minimum_count - 1): |
170 self.assertFalse(self.notifier.isInterestingStep( | 183 self.assertFalse(self.notifier.isInterestingStep( |
171 build_status, step_status, results)) | 184 build_status, step_status, results)) |
172 # Reset the counters by having other results. | 185 # Reset the counters by having other results. |
173 step_status = BuildStepStatusMock(TEST_STATUS_TEXT_2) | 186 step_status = BuildStepStatusMock(TEST_STATUS_TEXT_2) |
174 self.assertFalse(self.notifier.isInterestingStep( | 187 self.assertFalse(self.notifier.isInterestingStep( |
175 build_status, step_status, results)) | 188 build_status, step_status, results)) |
176 # Now check that we need to count back from the start. | 189 # Now check that we need to count back from the start. |
177 step_status = BuildStepStatusMock(TEST_STATUS_TEXT) | 190 step_status = BuildStepStatusMock(TEST_STATUS_TEXT) |
178 for _ in range(self.notifier.minimum_count - 1): | 191 for _ in range(self.notifier.minimum_count - 1): |
179 self.assertFalse(self.notifier.isInterestingStep( | 192 self.assertFalse(self.notifier.isInterestingStep( |
180 build_status, step_status, results)) | 193 build_status, step_status, results)) |
181 self.assertTrue(self.notifier.isInterestingStep( | 194 self.assertTrue(self.notifier.isInterestingStep( |
182 build_status, step_status, results)) | 195 build_status, step_status, results)) |
183 | 196 |
184 def testCountIsCorrectMultipleRegressOnly(self): | 197 def testCountIsCorrectMultipleRegressOnly(self): |
185 """Test count of multiple REGRESS only is correct.""" | 198 """Test count of multiple REGRESS only is correct.""" |
186 build_status = None | 199 build_status = getBuildStatusMock('test_build') |
187 step_status = BuildStepStatusMock(TEST_STATUS_MULTI_REGRESS) | 200 step_status = BuildStepStatusMock(TEST_STATUS_MULTI_REGRESS) |
188 results = [FAILURE] | 201 results = [FAILURE] |
189 for _ in range(self.notifier.minimum_count): | 202 for _ in range(self.notifier.minimum_count): |
190 self.notifier.isInterestingStep(build_status, step_status, results) | 203 self.notifier.isInterestingStep(build_status, step_status, results) |
191 | 204 |
192 self.assertEqual(self.notifier.recent_results.GetCount('REGRESS time/t'), | 205 self.assertEqual(self.getResultCount('REGRESS time/t test_build'), |
193 self.notifier.minimum_count) | 206 self.notifier.minimum_count) |
194 self.assertEqual(self.notifier.recent_results.GetCount('REGRESS fps/video'), | 207 self.assertEqual(self.getResultCount('REGRESS fps/video test_build'), |
195 self.notifier.minimum_count) | 208 self.notifier.minimum_count) |
196 self.assertEqual( | 209 self.assertEqual( |
197 self.notifier.recent_results.GetCount('REGRESS fps/video2'), | 210 self.getResultCount('REGRESS fps/video2 test_build'), |
198 self.notifier.minimum_count) | 211 self.notifier.minimum_count) |
199 | 212 |
200 def testCountIsCorrectMultipleImproveOnly(self): | 213 def testCountIsCorrectMultipleImproveOnly(self): |
201 """Test count of multiple IMPROVE only is correct.""" | 214 """Test count of multiple IMPROVE only is correct.""" |
202 build_status = None | 215 build_status = getBuildStatusMock('test_build') |
203 step_status = BuildStepStatusMock(TEST_STATUS_MULTI_IMPROVE) | 216 step_status = BuildStepStatusMock(TEST_STATUS_MULTI_IMPROVE) |
204 results = [FAILURE] | 217 results = [FAILURE] |
205 for _ in range(self.notifier.minimum_count): | 218 for _ in range(self.notifier.minimum_count): |
206 self.notifier.isInterestingStep(build_status, step_status, results) | 219 self.notifier.isInterestingStep(build_status, step_status, results) |
207 | 220 |
208 self.assertEqual(self.notifier.recent_results.GetCount('IMPROVE time/t'), | 221 self.assertEqual(self.getResultCount('IMPROVE time/t test_build'), |
209 self.notifier.minimum_count) | 222 self.notifier.minimum_count) |
210 self.assertEqual(self.notifier.recent_results.GetCount('IMPROVE fps/video'), | 223 self.assertEqual(self.getResultCount('IMPROVE fps/video test_build'), |
211 self.notifier.minimum_count) | 224 self.notifier.minimum_count) |
212 self.assertEqual( | 225 self.assertEqual( |
213 self.notifier.recent_results.GetCount('IMPROVE fps/video2'), | 226 self.getResultCount('IMPROVE fps/video2 test_build'), |
214 self.notifier.minimum_count) | 227 self.notifier.minimum_count) |
215 | 228 |
216 def testCountIsCorrectMultipleRegressImprove(self): | 229 def testCountIsCorrectMultipleRegressImprove(self): |
217 """Test count of multiple REGRESS and IMPROVE is correct.""" | 230 """Test count of multiple REGRESS and IMPROVE is correct.""" |
218 build_status = None | 231 build_status = getBuildStatusMock('test_build') |
219 step_status = BuildStepStatusMock(TEST_STATUS_MULTI_REGRESS_IMPROVE) | 232 step_status = BuildStepStatusMock(TEST_STATUS_MULTI_REGRESS_IMPROVE) |
220 results = [FAILURE] | 233 results = [FAILURE] |
221 for _ in range(self.notifier.minimum_count): | 234 for _ in range(self.notifier.minimum_count): |
222 self.notifier.isInterestingStep(build_status, step_status, results) | 235 self.notifier.isInterestingStep(build_status, step_status, results) |
223 | 236 |
224 self.assertEqual(self.notifier.recent_results.GetCount('REGRESS time/t'), | 237 self.assertEqual(self.getResultCount('REGRESS time/t test_build'), |
225 self.notifier.minimum_count) | 238 self.notifier.minimum_count) |
226 self.assertEqual(self.notifier.recent_results.GetCount('REGRESS fps/video'), | 239 self.assertEqual(self.getResultCount('REGRESS fps/video test_build'), |
227 self.notifier.minimum_count) | 240 self.notifier.minimum_count) |
228 self.assertEqual( | 241 self.assertEqual( |
229 self.notifier.recent_results.GetCount('REGRESS fps/video2'), | 242 self.getResultCount('REGRESS fps/video2 test_build'), |
230 self.notifier.minimum_count) | 243 self.notifier.minimum_count) |
231 | 244 |
232 self.assertEqual(self.notifier.recent_results.GetCount('IMPROVE cpu/t'), | 245 self.assertEqual(self.getResultCount('IMPROVE cpu/t test_build'), |
233 self.notifier.minimum_count) | 246 self.notifier.minimum_count) |
234 self.assertEqual(self.notifier.recent_results.GetCount('IMPROVE cpu/t2'), | 247 self.assertEqual(self.getResultCount('IMPROVE cpu/t2 test_build'), |
235 self.notifier.minimum_count) | 248 self.notifier.minimum_count) |
236 | 249 |
237 def testEmailContext(self): | 250 def testEmailContext(self): |
238 """Tests email context contains relative failures.""" | 251 """Tests email context contains relative failures.""" |
239 # Needed so that callback details are retained after method call. | 252 # Needed so that callback details are retained after method call. |
240 twisted.internet.defer.Deferred._startRunCallbacks = mock.Mock() | 253 twisted.internet.defer.Deferred._startRunCallbacks = mock.Mock() |
241 self.notifier.minimum_delay_between_alert = 0 | 254 self.notifier.minimum_delay_between_alert = 0 |
242 | 255 |
243 step_status = BuildStepStatusMock(TEST_STATUS_MULTI_REGRESS) | 256 step_status = BuildStepStatusMock(TEST_STATUS_MULTI_REGRESS) |
244 build_status = mock.Mock() | 257 build_status = getBuildStatusMock('test_build') |
245 build_status.getSourceStamp.return_value = None | |
246 build_status.getResponsibleUsers.return_value = '' | |
247 build_status.getChanges.return_value = '' | |
248 | 258 |
249 self.notifier.master_status = mock.Mock() | 259 self.notifier.master_status = mock.Mock() |
250 self.notifier.master_status.getBuildbotURL.return_value = '' | 260 self.notifier.master_status.getBuildbotURL.return_value = '' |
251 | 261 |
252 build_utils.EmailableBuildTable = mock.Mock(return_value='') | 262 build_utils.EmailableBuildTable = mock.Mock(return_value='') |
253 | 263 |
254 results = [FAILURE] | 264 results = [FAILURE] |
255 for _ in range(self.notifier.minimum_count): | 265 for _ in range(self.notifier.minimum_count): |
256 self.notifier.isInterestingStep(build_status, step_status, results) | 266 self.notifier.isInterestingStep(build_status, step_status, results) |
257 email = self.notifier.buildMessage(builder_name='', | 267 email = self.notifier.buildMessage(builder_name='', |
(...skipping 18 matching lines...) Expand all Loading... | |
276 first_callback = email.callbacks[0] | 286 first_callback = email.callbacks[0] |
277 callback_args = first_callback[0][1] # Defer.addCallBacks implementation | 287 callback_args = first_callback[0][1] # Defer.addCallBacks implementation |
278 email_content = callback_args[1].as_string() # [0] is receipients | 288 email_content = callback_args[1].as_string() # [0] is receipients |
279 | 289 |
280 self.assertTrue('New perf results in this email' in email_content) | 290 self.assertTrue('New perf results in this email' in email_content) |
281 self.assertTrue('PERF_REGRESS: time/t, fps/video, fps/video2.' not in | 291 self.assertTrue('PERF_REGRESS: time/t, fps/video, fps/video2.' not in |
282 email_content) | 292 email_content) |
283 self.assertTrue('PERF_REGRESS: time/t2.' in email_content) | 293 self.assertTrue('PERF_REGRESS: time/t2.' in email_content) |
284 self.assertTrue('PERF_IMPROVE: fps/video2.' in email_content) | 294 self.assertTrue('PERF_IMPROVE: fps/video2.' in email_content) |
285 | 295 |
296 def testResultsForDifferentBuilders(self): | |
297 """Tests that results are unique per builder.""" | |
298 build_linux = getBuildStatusMock('test_linux') | |
299 build_win = getBuildStatusMock('test_win') | |
300 step_status = BuildStepStatusMock(TEST_STATUS_MULTI_IMPROVE) | |
301 results = [FAILURE] | |
302 for _ in range(self.notifier.minimum_count): | |
303 self.notifier.isInterestingStep(build_linux, step_status, results) | |
304 self.notifier.isInterestingStep(build_win, step_status, results) | |
305 | |
306 # Check results store the builder names | |
307 self.assertEqual(self.getResultCount('IMPROVE time/t test_linux'), | |
308 self.notifier.minimum_count) | |
309 self.assertEqual(self.getResultCount('IMPROVE time/t test_win'), | |
310 self.notifier.minimum_count) | |
311 | |
312 # Reset only build_linux results | |
313 results = [SUCCESS] | |
314 self.assertFalse(self.notifier.isInterestingStep( | |
315 build_linux, step_status, results)) | |
316 | |
317 # Check build_win results are intact. | |
318 self.assertEqual(self.getResultCount('IMPROVE time/t test_linux'), 0) | |
319 self.assertEqual(self.getResultCount('IMPROVE time/t test_win'), | |
320 self.notifier.minimum_count) | |
321 | |
322 results = [FAILURE] | |
323 # Add build_lin results | |
324 for _ in range(self.notifier.minimum_count): | |
325 self.notifier.isInterestingStep(build_linux, step_status, results) | |
326 | |
327 # Check results store the builder names | |
328 self.assertEqual(self.getResultCount('IMPROVE time/t test_linux'), | |
329 self.notifier.minimum_count) | |
330 self.assertEqual(self.getResultCount('IMPROVE time/t test_win'), | |
331 self.notifier.minimum_count) | |
332 | |
333 # Reset only build_win results | |
334 results = [SUCCESS] | |
335 self.assertFalse(self.notifier.isInterestingStep( | |
336 build_win, step_status, results)) | |
337 | |
338 # Check build_lin results are intact. | |
339 self.assertEqual(self.getResultCount('IMPROVE time/t test_win'), 0) | |
340 self.assertEqual(self.getResultCount('IMPROVE time/t test_linux'), | |
341 self.notifier.minimum_count) | |
342 | |
286 | 343 |
287 class BuildStepStatusMock(mock.Mock): | 344 class BuildStepStatusMock(mock.Mock): |
288 def __init__(self, text): | 345 def __init__(self, text): |
289 self.text = text | 346 self.text = text |
290 mock.Mock.__init__(self) | 347 mock.Mock.__init__(self) |
291 | 348 |
292 def getText(self): | 349 def getText(self): |
293 return [self.text] | 350 return [self.text] |
294 | 351 |
295 | 352 |
296 if __name__ == '__main__': | 353 if __name__ == '__main__': |
297 unittest.main() | 354 unittest.main() |
OLD | NEW |