OLD | NEW |
---|---|
1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 import json | 5 import json |
6 import os | 6 import os |
7 import re | 7 import re |
8 import subprocess | 8 import subprocess |
9 import sys | 9 import sys |
10 | 10 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
46 An instance of this class can be passed to presubmit unittests for outputing | 46 An instance of this class can be passed to presubmit unittests for outputing |
47 various types of results. | 47 various types of results. |
48 """ | 48 """ |
49 | 49 |
50 class PresubmitResult(object): | 50 class PresubmitResult(object): |
51 def __init__(self, message, items=None, long_text=''): | 51 def __init__(self, message, items=None, long_text=''): |
52 self.message = message | 52 self.message = message |
53 self.items = items | 53 self.items = items |
54 self.long_text = long_text | 54 self.long_text = long_text |
55 | 55 |
56 def __repr__(self): | |
57 return self.message | |
Paweł Hajdan Jr.
2015/01/07 16:41:12
Why is this needed?
| |
58 | |
56 class PresubmitError(PresubmitResult): | 59 class PresubmitError(PresubmitResult): |
57 def __init__(self, message, items, long_text=''): | 60 def __init__(self, message, items, long_text=''): |
58 MockOutputApi.PresubmitResult.__init__(self, message, items, long_text) | 61 MockOutputApi.PresubmitResult.__init__(self, message, items, long_text) |
59 self.type = 'error' | 62 self.type = 'error' |
60 | 63 |
61 class PresubmitPromptWarning(PresubmitResult): | 64 class PresubmitPromptWarning(PresubmitResult): |
62 def __init__(self, message, items, long_text=''): | 65 def __init__(self, message, items, long_text=''): |
63 MockOutputApi.PresubmitResult.__init__(self, message, items, long_text) | 66 MockOutputApi.PresubmitResult.__init__(self, message, items, long_text) |
64 self.type = 'warning' | 67 self.type = 'warning' |
65 | 68 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
101 | 104 |
102 This class can be used in presubmit unittests to mock the query of the | 105 This class can be used in presubmit unittests to mock the query of the |
103 current change. | 106 current change. |
104 """ | 107 """ |
105 | 108 |
106 def __init__(self, changed_files): | 109 def __init__(self, changed_files): |
107 self._changed_files = changed_files | 110 self._changed_files = changed_files |
108 | 111 |
109 def LocalPaths(self): | 112 def LocalPaths(self): |
110 return self._changed_files | 113 return self._changed_files |
OLD | NEW |