| 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 29 matching lines...) Expand all Loading... |
| 40 # "webkitpy." so as not to conflict with test-webkitpy logging. | 40 # "webkitpy." so as not to conflict with test-webkitpy logging. |
| 41 logger = logging.getLogger('unittest') | 41 logger = logging.getLogger('unittest') |
| 42 | 42 |
| 43 # Configure the test logger not to pass messages along to the | 43 # Configure the test logger not to pass messages along to the |
| 44 # root logger. This prevents test messages from being | 44 # root logger. This prevents test messages from being |
| 45 # propagated to loggers used by test-webkitpy logging (e.g. | 45 # propagated to loggers used by test-webkitpy logging (e.g. |
| 46 # the root logger). | 46 # the root logger). |
| 47 logger.propagate = False | 47 logger.propagate = False |
| 48 | 48 |
| 49 logging_level = self._logging_level() | 49 logging_level = self._logging_level() |
| 50 self._handlers = configure_logging(logging_level=logging_level, logger=l
ogger, stream=log_stream) | 50 self._handlers = configure_logging(logging_level=logging_level, logger=l
ogger, stream=log_stream, include_time=False) |
| 51 self._log = logger | 51 self._log = logger |
| 52 self._log_stream = log_stream | 52 self._log_stream = log_stream |
| 53 | 53 |
| 54 def tearDown(self): | 54 def tearDown(self): |
| 55 """Reset logging to its original state. | 55 """Reset logging to its original state. |
| 56 | 56 |
| 57 This method ensures that the logging configuration set up | 57 This method ensures that the logging configuration set up |
| 58 for a unit test does not affect logging in other unit tests. | 58 for a unit test does not affect logging in other unit tests. |
| 59 """ | 59 """ |
| 60 logger = self._log | 60 logger = self._log |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 def _logging_level(self): | 119 def _logging_level(self): |
| 120 return self._level | 120 return self._level |
| 121 | 121 |
| 122 def test_logged_message(self): | 122 def test_logged_message(self): |
| 123 self._log.log(self._level, 'test message') | 123 self._log.log(self._level, 'test message') |
| 124 self._assert_log_messages(['test message\n']) | 124 self._assert_log_messages(['test message\n']) |
| 125 | 125 |
| 126 def test_below_threshold_message(self): | 126 def test_below_threshold_message(self): |
| 127 self._log.log(self._level - 1, 'test message') | 127 self._log.log(self._level - 1, 'test message') |
| 128 self._assert_log_messages([]) | 128 self._assert_log_messages([]) |
| OLD | NEW |