| OLD | NEW |
| 1 # Copyright (c) 2009, Google Inc. All rights reserved. | 1 # Copyright (c) 2009, Google Inc. All rights reserved. |
| 2 # | 2 # |
| 3 # Redistribution and use in source and binary forms, with or without | 3 # Redistribution and use in source and binary forms, with or without |
| 4 # modification, are permitted provided that the following conditions are | 4 # modification, are permitted provided that the following conditions are |
| 5 # met: | 5 # met: |
| 6 # | 6 # |
| 7 # * Redistributions of source code must retain the above copyright | 7 # * 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 # * Redistributions in binary form must reproduce the above | 9 # * Redistributions in binary form must reproduce the above |
| 10 # copyright notice, this list of conditions and the following disclaimer | 10 # copyright notice, this list of conditions and the following disclaimer |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 23 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 24 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 24 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 25 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 25 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 26 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 26 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 27 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 27 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 28 # | 28 # |
| 29 # Class for unittest support. Used for capturing stderr/stdout. | 29 # Class for unittest support. Used for capturing stderr/stdout. |
| 30 | 30 |
| 31 import logging | 31 import logging |
| 32 import sys | 32 import sys |
| 33 import unittest | |
| 34 | 33 |
| 35 from StringIO import StringIO | 34 from StringIO import StringIO |
| 36 | 35 |
| 37 | 36 |
| 38 class OutputCapture(object): | 37 class OutputCapture(object): |
| 39 | 38 |
| 40 def __init__(self): | 39 def __init__(self): |
| 41 self.saved_outputs = dict() | 40 self.saved_outputs = dict() |
| 42 self._log_level = logging.INFO | 41 self._log_level = logging.INFO |
| 43 | 42 |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 testassert = testcase.assertMultiLineEqual | 93 testassert = testcase.assertMultiLineEqual |
| 95 else: | 94 else: |
| 96 testassert = testcase.assertEqual | 95 testassert = testcase.assertEqual |
| 97 | 96 |
| 98 testassert(stdout_string, expected_stdout) | 97 testassert(stdout_string, expected_stdout) |
| 99 testassert(stderr_string, expected_stderr) | 98 testassert(stderr_string, expected_stderr) |
| 100 if expected_logs is not None: | 99 if expected_logs is not None: |
| 101 testassert(logs_string, expected_logs) | 100 testassert(logs_string, expected_logs) |
| 102 # This is a little strange, but I don't know where else to return this i
nformation. | 101 # This is a little strange, but I don't know where else to return this i
nformation. |
| 103 return return_value | 102 return return_value |
| OLD | NEW |