Chromium Code Reviews| 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 error |= (isinstance(handler(obj), Failure) and not |
| 484 isinstance(obj, NoMatchingTestsError)) | |
|
ghost stip (do not use)
2014/11/15 01:32:27
note that this is obj, and not handler(obj)
iannucci
2014/11/15 01:34:19
shouldn't this check come before we run handler on
ghost stip (do not use)
2014/11/15 01:38:12
Acknowledged.
| |
| 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 |