Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(186)

Side by Side Diff: verification/fake.py

Issue 138173005: CQ to always post a message when Commit box is unchecked. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/commit-queue
Patch Set: Addressed reviewer's comments Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « tests/pending_manager_test.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # coding=utf8 1 # coding=utf8
2 # Copyright (c) 2011 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2011 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 """A verifier that does nothing.""" 5 """A verifier that does nothing."""
6 6
7 from verification import base 7 from verification import base
8 8
9 def failed_message():
10 return 'FakeVerifier FAILED'
9 11
10 class FakeVerifier(base.Verifier): 12 class FakeVerifier(base.Verifier):
11 name = 'fake' 13 name = 'fake'
12 14
13 def __init__(self, state): 15 def __init__(self, state):
14 super(FakeVerifier, self).__init__() 16 super(FakeVerifier, self).__init__()
15 self.state = state 17 self.state = state
16 18
17 def verify(self, pending): 19 def verify(self, pending):
18 pending.verifications[self.name] = base.SimpleStatus(self.state) 20 fake = base.SimpleStatus(self.state)
21 # Make sure to leave a message, so CQ tests can reliably test for it.
22 if self.state == base.FAILED:
23 fake.error_message = failed_message()
24 pending.verifications[self.name] = fake
19 25
20 def update_status(self, queue): 26 def update_status(self, queue):
21 pass 27 pass
22 28
23 29
24 class DeferredFakeVerifier(base.Verifier): 30 class DeferredFakeVerifier(base.Verifier):
25 name = 'fake' 31 name = 'fake'
26 32
27 def __init__(self, state, delay): 33 def __init__(self, state, delay):
28 super(DeferredFakeVerifier, self).__init__() 34 super(DeferredFakeVerifier, self).__init__()
29 self.state = state 35 self.state = state
30 self.delay = delay 36 self.delay = delay
31 37
32 def verify(self, pending): 38 def verify(self, pending):
33 pending.verifications[self.name] = base.SimpleStatus() 39 pending.verifications[self.name] = base.SimpleStatus()
34 40
35 def update_status(self, queue): 41 def update_status(self, queue):
36 if self.delay: 42 if self.delay:
37 self.delay -= 1 43 self.delay -= 1
38 return 44 return
39 45
40 for _, fake in self.loop(queue, base.SimpleStatus, True): 46 for _, fake in self.loop(queue, base.SimpleStatus, True):
41 fake.state = self.state 47 fake.state = self.state
48 # Make sure to leave a message, so CQ tests can reliably test for it.
49 if self.state == base.FAILED:
50 fake.error_message = failed_message()
OLDNEW
« no previous file with comments | « tests/pending_manager_test.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698