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

Side by Side Diff: verification/fake.py

Issue 138133014: Revert of 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: 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'
11 9
12 class FakeVerifier(base.Verifier): 10 class FakeVerifier(base.Verifier):
13 name = 'fake' 11 name = 'fake'
14 12
15 def __init__(self, state): 13 def __init__(self, state):
16 super(FakeVerifier, self).__init__() 14 super(FakeVerifier, self).__init__()
17 self.state = state 15 self.state = state
18 16
19 def verify(self, pending): 17 def verify(self, pending):
20 fake = base.SimpleStatus(self.state) 18 pending.verifications[self.name] = 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
25 19
26 def update_status(self, queue): 20 def update_status(self, queue):
27 pass 21 pass
28 22
29 23
30 class DeferredFakeVerifier(base.Verifier): 24 class DeferredFakeVerifier(base.Verifier):
31 name = 'fake' 25 name = 'fake'
32 26
33 def __init__(self, state, delay): 27 def __init__(self, state, delay):
34 super(DeferredFakeVerifier, self).__init__() 28 super(DeferredFakeVerifier, self).__init__()
35 self.state = state 29 self.state = state
36 self.delay = delay 30 self.delay = delay
37 31
38 def verify(self, pending): 32 def verify(self, pending):
39 pending.verifications[self.name] = base.SimpleStatus() 33 pending.verifications[self.name] = base.SimpleStatus()
40 34
41 def update_status(self, queue): 35 def update_status(self, queue):
42 if self.delay: 36 if self.delay:
43 self.delay -= 1 37 self.delay -= 1
44 return 38 return
45 39
46 for _, fake in self.loop(queue, base.SimpleStatus, True): 40 for _, fake in self.loop(queue, base.SimpleStatus, True):
47 fake.state = self.state 41 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