| OLD | NEW |
| 1 # Copyright (C) 2012 Google, Inc. | 1 # Copyright (C) 2012 Google, Inc. |
| 2 # Copyright (C) 2010 Chris Jerdonek (cjerdonek@webkit.org) | 2 # Copyright (C) 2010 Chris Jerdonek (cjerdonek@webkit.org) |
| 3 # | 3 # |
| 4 # Redistribution and use in source and binary forms, with or without | 4 # Redistribution and use in source and binary forms, with or without |
| 5 # modification, are permitted provided that the following conditions | 5 # modification, are permitted provided that the following conditions |
| 6 # are met: | 6 # are met: |
| 7 # 1. Redistributions of source code must retain the above copyright | 7 # 1. Redistributions of source code must retain the above copyright |
| 8 # notice, this list of conditions and the following disclaimer. | 8 # notice, this list of conditions and the following disclaimer. |
| 9 # 2. Redistributions in binary form must reproduce the above copyright | 9 # 2. Redistributions in binary form must reproduce the above copyright |
| 10 # notice, this list of conditions and the following disclaimer in the | 10 # notice, this list of conditions and the following disclaimer in the |
| 11 # documentation and/or other materials provided with the distribution. | 11 # documentation and/or other materials provided with the distribution. |
| 12 # | 12 # |
| 13 # THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND | 13 # THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND |
| 14 # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | 14 # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
| 15 # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 15 # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
| 16 # DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR | 16 # DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR |
| 17 # ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | 17 # ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
| 18 # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | 18 # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
| 19 # SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | 19 # SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
| 20 # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | 20 # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
| 21 # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 21 # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 22 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 22 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 23 | 23 |
| 24 import StringIO |
| 24 import logging | 25 import logging |
| 25 import StringIO | |
| 26 | 26 |
| 27 from webkitpy.common.system import outputcapture |
| 27 from webkitpy.common.system.systemhost import SystemHost | 28 from webkitpy.common.system.systemhost import SystemHost |
| 28 from webkitpy.layout_tests.views.metered_stream import MeteredStream | 29 from webkitpy.layout_tests.views.metered_stream import MeteredStream |
| 29 | 30 |
| 30 _log = logging.getLogger(__name__) | 31 _log = logging.getLogger(__name__) |
| 31 | 32 |
| 32 | 33 |
| 33 class Printer(object): | 34 class Printer(object): |
| 34 def __init__(self, stream, options=None): | 35 def __init__(self, stream, options=None): |
| 35 self.stream = stream | 36 self.stream = stream |
| 36 self.meter = None | 37 self.meter = None |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 | 96 |
| 96 testing_filter = logging.Filter() | 97 testing_filter = logging.Filter() |
| 97 testing_filter.filter = filter_records | 98 testing_filter.filter = filter_records |
| 98 | 99 |
| 99 # Display a message so developers are not mystified as to why | 100 # Display a message so developers are not mystified as to why |
| 100 # logging does not work in the unit tests. | 101 # logging does not work in the unit tests. |
| 101 _log.info("Suppressing most webkitpy logging while running unit tests.") | 102 _log.info("Suppressing most webkitpy logging while running unit tests.") |
| 102 handler.addFilter(testing_filter) | 103 handler.addFilter(testing_filter) |
| 103 | 104 |
| 104 if self.options.pass_through: | 105 if self.options.pass_through: |
| 105 # FIXME: Can't import at top of file, as outputcapture needs unittes
t2 | |
| 106 from webkitpy.common.system import outputcapture | |
| 107 outputcapture.OutputCapture.stream_wrapper = _CaptureAndPassThroughS
tream | 106 outputcapture.OutputCapture.stream_wrapper = _CaptureAndPassThroughS
tream |
| 108 | 107 |
| 109 def write_update(self, msg): | 108 def write_update(self, msg): |
| 110 self.meter.write_update(msg) | 109 self.meter.write_update(msg) |
| 111 | 110 |
| 112 def print_started_test(self, source, test_name): | 111 def print_started_test(self, source, test_name): |
| 113 self.running_tests.append(test_name) | 112 self.running_tests.append(test_name) |
| 114 if len(self.running_tests) > 1: | 113 if len(self.running_tests) > 1: |
| 115 suffix = ' (+%d)' % (len(self.running_tests) - 1) | 114 suffix = ' (+%d)' % (len(self.running_tests) - 1) |
| 116 else: | 115 else: |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 import inspect | 203 import inspect |
| 205 import pdb | 204 import pdb |
| 206 stack = inspect.stack() | 205 stack = inspect.stack() |
| 207 return any(frame[1] == pdb.__file__.replace('.pyc', '.py') for frame in
stack) | 206 return any(frame[1] == pdb.__file__.replace('.pyc', '.py') for frame in
stack) |
| 208 | 207 |
| 209 def flush(self): | 208 def flush(self): |
| 210 self._stream.flush() | 209 self._stream.flush() |
| 211 | 210 |
| 212 def getvalue(self): | 211 def getvalue(self): |
| 213 return self._buffer.getvalue() | 212 return self._buffer.getvalue() |
| OLD | NEW |