Lines Matching defs:messages

25 Provides support for unit-testing messages logged using the built-in
43 Log messages captured by instances of this object can be tested
56 self.messages = []
57 """A list of log messages written to the stream."""
64 self.messages.append(message)
69 def assertMessages(self, messages):
70 """Assert that the given messages match the logged messages.
72 messages: A list of log message strings.
75 self._test_case.assertEquals(messages, self.messages)
80 """Supports end-to-end unit-testing of log messages.
95 # Check the resulting log messages.
128 Only messages logged at or above the given level are logged
144 of log messages you would like to test.
164 """Assert there are no remaining log messages, and reset logging.
166 This method asserts that there are no more messages in the array of
167 log messages, and then restores logging to its original state.
176 def messages(self):
177 """Return the current list of log messages."""
178 return self._test_stream.messages
183 # We clear the log messages after asserting since they are no longer
187 # that there are no remaining log messages to be asserted.
189 # The latter ensures that no extra log messages are getting logged that
193 def assertMessages(self, messages):
194 """Assert the current array of log messages, and clear its contents.
197 messages: A list of log message strings.
201 self._test_stream.assertMessages(messages)
203 # We want to clear the array of messages even in the case of
207 self._test_stream.messages = []
220 """Supports end-to-end unit-testing of log messages.
229 # Check the resulting log messages.
242 """Return the current list of log messages."""
243 return self._log.messages()
249 # an explanation of why we clear the array of messages after
251 def assertLog(self, messages):
252 """Assert the current array of log messages, and clear its contents.
255 messages: A list of log message strings.
258 self._log.assertMessages(messages)