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 from contextlib import contextmanager | 5 from contextlib import contextmanager |
6 import copy | 6 import copy |
7 import inspect | 7 import inspect |
8 import os | 8 import os |
9 import re | 9 import re |
10 | 10 |
(...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
473 flexible interface for dealing with |objects|. | 473 flexible interface for dealing with |objects|. |
474 | 474 |
475 @param opts: Parsed CLI options | 475 @param opts: Parsed CLI options |
476 @param objects: Iteraterable of objects from GenStage and RunStage. | 476 @param objects: Iteraterable of objects from GenStage and RunStage. |
477 """ | 477 """ |
478 error = False | 478 error = False |
479 aborted = False | 479 aborted = False |
480 handler = cls.ResultStageHandler(opts) | 480 handler = cls.ResultStageHandler(opts) |
481 try: | 481 try: |
482 for obj in objects: | 482 for obj in objects: |
483 error |= isinstance(handler(obj), Failure) | 483 if not isinstance(obj, NoMatchingTestsError): |
| 484 error |= isinstance(handler(obj), Failure) |
484 except ResultStageAbort: | 485 except ResultStageAbort: |
485 aborted = True | 486 aborted = True |
486 handler.finalize(aborted) | 487 handler.finalize(aborted) |
487 return error | 488 return error |
488 | 489 |
489 class ResultStageHandler(object): | 490 class ResultStageHandler(object): |
490 """SAX-like event handler dispatches to self.handle_{type(obj).__name__} | 491 """SAX-like event handler dispatches to self.handle_{type(obj).__name__} |
491 | 492 |
492 So if |obj| is a Test, this would call self.handle_Test(obj). | 493 So if |obj| is a Test, this would call self.handle_Test(obj). |
493 | 494 |
(...skipping 24 matching lines...) Expand all Loading... |
518 print 'UNHANDLED:', obj | 519 print 'UNHANDLED:', obj |
519 return Failure() | 520 return Failure() |
520 | 521 |
521 def finalize(self, aborted): | 522 def finalize(self, aborted): |
522 """Called after __call__() has been called for all results. | 523 """Called after __call__() has been called for all results. |
523 | 524 |
524 @param aborted: True if the user aborted the run. | 525 @param aborted: True if the user aborted the run. |
525 @type aborted: bool | 526 @type aborted: bool |
526 """ | 527 """ |
527 pass | 528 pass |
OLD | NEW |