| OLD | NEW |
| 1 # Copyright (C) 2010 Chris Jerdonek (cjerdonek@webkit.org) | 1 # Copyright (C) 2010 Chris Jerdonek (cjerdonek@webkit.org) |
| 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 | 4 # modification, are permitted provided that the following conditions |
| 5 # are met: | 5 # are met: |
| 6 # 1. Redistributions of source code must retain the above copyright | 6 # 1. Redistributions of source code must retain the above copyright |
| 7 # notice, this list of conditions and the following disclaimer. | 7 # notice, this list of conditions and the following disclaimer. |
| 8 # 2. Redistributions in binary form must reproduce the above copyright | 8 # 2. Redistributions in binary form must reproduce the above copyright |
| 9 # notice, this list of conditions and the following disclaimer in the | 9 # notice, this list of conditions and the following disclaimer in the |
| 10 # documentation and/or other materials provided with the distribution. | 10 # documentation and/or other materials provided with the distribution. |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 | 53 |
| 54 """ | 54 """ |
| 55 self._test_case = test_case | 55 self._test_case = test_case |
| 56 self.messages = [] | 56 self.messages = [] |
| 57 """A list of log messages written to the stream.""" | 57 """A list of log messages written to the stream.""" |
| 58 | 58 |
| 59 # Python documentation says that any object passed to the StreamHandler | 59 # Python documentation says that any object passed to the StreamHandler |
| 60 # constructor should support write() and flush(): | 60 # constructor should support write() and flush(): |
| 61 # | 61 # |
| 62 # http://docs.python.org/library/logging.html#module-logging.handlers | 62 # http://docs.python.org/library/logging.html#module-logging.handlers |
| 63 |
| 63 def write(self, message): | 64 def write(self, message): |
| 64 self.messages.append(message) | 65 self.messages.append(message) |
| 65 | 66 |
| 66 def flush(self): | 67 def flush(self): |
| 67 pass | 68 pass |
| 68 | 69 |
| 69 def assertMessages(self, messages): | 70 def assertMessages(self, messages): |
| 70 """Assert that the given messages match the logged messages. | 71 """Assert that the given messages match the logged messages. |
| 71 | 72 |
| 72 messages: A list of log message strings. | 73 messages: A list of log message strings. |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 249 # an explanation of why we clear the array of messages after | 250 # an explanation of why we clear the array of messages after |
| 250 # asserting its contents. | 251 # asserting its contents. |
| 251 def assertLog(self, messages): | 252 def assertLog(self, messages): |
| 252 """Assert the current array of log messages, and clear its contents. | 253 """Assert the current array of log messages, and clear its contents. |
| 253 | 254 |
| 254 Args: | 255 Args: |
| 255 messages: A list of log message strings. | 256 messages: A list of log message strings. |
| 256 | 257 |
| 257 """ | 258 """ |
| 258 self._log.assertMessages(messages) | 259 self._log.assertMessages(messages) |
| OLD | NEW |