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 os | 5 import os |
6 | 6 |
7 from collections import namedtuple | 7 from collections import namedtuple |
8 | 8 |
9 UnknownError = namedtuple('UnknownError', 'message') | 9 UnknownError = namedtuple('UnknownError', 'message') |
10 TestError = namedtuple('TestError', 'test message') | 10 TestError = namedtuple('TestError', 'test message') |
| 11 NoMatchingTestsError = namedtuple('NoMatchingTestsError', '') |
11 Result = namedtuple('Result', 'data') | 12 Result = namedtuple('Result', 'data') |
12 | 13 |
13 class ResultStageAbort(Exception): | 14 class ResultStageAbort(Exception): |
14 pass | 15 pass |
15 | 16 |
16 | 17 |
17 class Failure(object): | 18 class Failure(object): |
18 pass | 19 pass |
19 | 20 |
20 | 21 |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 def __call__(self, obj): | 163 def __call__(self, obj): |
163 """Called to handle each object in the ResultStage | 164 """Called to handle each object in the ResultStage |
164 | 165 |
165 @type obj: Anything passed to put_result in GenStage or RunStage. | 166 @type obj: Anything passed to put_result in GenStage or RunStage. |
166 | 167 |
167 @return: If the handler method returns Failure(), then it will | 168 @return: If the handler method returns Failure(), then it will |
168 cause the entire test run to ultimately return an error code. | 169 cause the entire test run to ultimately return an error code. |
169 """ | 170 """ |
170 return getattr(self, 'handle_' + type(obj).__name__, self.__unknown)(obj) | 171 return getattr(self, 'handle_' + type(obj).__name__, self.__unknown)(obj) |
171 | 172 |
| 173 def handle_NoMatchingTestsError(self, _error): |
| 174 print 'No tests found that match the glob: %s' % ( |
| 175 ' '.join(self.opts.test_glob),) |
| 176 return Failure() |
| 177 |
172 def __unknown(self, obj): | 178 def __unknown(self, obj): |
173 if self.opts.verbose: | 179 if self.opts.verbose: |
174 print 'UNHANDLED:', obj | 180 print 'UNHANDLED:', obj |
175 return Failure() | 181 return Failure() |
176 | 182 |
177 def finalize(self, aborted): | 183 def finalize(self, aborted): |
178 """Called after __call__() has been called for all results. | 184 """Called after __call__() has been called for all results. |
179 | 185 |
180 @param aborted: True if the user aborted the run. | 186 @param aborted: True if the user aborted the run. |
181 @type aborted: bool | 187 @type aborted: bool |
182 """ | 188 """ |
183 pass | 189 pass |
OLD | NEW |