| 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 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 self._assert_log_messages([]) | 122 self._assert_log_messages([]) |
| 123 | 123 |
| 124 def test_two_messages(self): | 124 def test_two_messages(self): |
| 125 self._log.info("message1") | 125 self._log.info("message1") |
| 126 self._log.info("message2") | 126 self._log.info("message2") |
| 127 self._assert_log_messages(["message1\n", | 127 self._assert_log_messages(["message1\n", |
| 128 "message2\n"]) | 128 "message2\n"]) |
| 129 | 129 |
| 130 | 130 |
| 131 class ConfigureLoggingVerboseTest(ConfigureLoggingTestBase): | 131 class ConfigureLoggingVerboseTest(ConfigureLoggingTestBase): |
| 132 |
| 132 def _logging_level(self): | 133 def _logging_level(self): |
| 133 return logging.DEBUG | 134 return logging.DEBUG |
| 134 | 135 |
| 135 def test_info_message(self): | 136 def test_info_message(self): |
| 136 self._log.info("test message") | 137 self._log.info("test message") |
| 137 self._assert_log_messages(["unittest: [INFO] test message\n"]) | 138 self._assert_log_messages(["unittest: [INFO] test message\n"]) |
| 138 | 139 |
| 139 def test_debug_message(self): | 140 def test_debug_message(self): |
| 140 self._log.debug("test message") | 141 self._log.debug("test message") |
| 141 self._assert_log_messages(["unittest: [DEBUG] test message\n"]) | 142 self._assert_log_messages(["unittest: [DEBUG] test message\n"]) |
| 142 | 143 |
| 144 |
| 143 class ConfigureLoggingCustomLevelTest(ConfigureLoggingTestBase): | 145 class ConfigureLoggingCustomLevelTest(ConfigureLoggingTestBase): |
| 144 | 146 |
| 145 """Tests configure_logging() with a custom logging level.""" | 147 """Tests configure_logging() with a custom logging level.""" |
| 146 | 148 |
| 147 _level = 36 | 149 _level = 36 |
| 148 | 150 |
| 149 def _logging_level(self): | 151 def _logging_level(self): |
| 150 return self._level | 152 return self._level |
| 151 | 153 |
| 152 def test_logged_message(self): | 154 def test_logged_message(self): |
| 153 self._log.log(self._level, "test message") | 155 self._log.log(self._level, "test message") |
| 154 self._assert_log_messages(["test message\n"]) | 156 self._assert_log_messages(["test message\n"]) |
| 155 | 157 |
| 156 def test_below_threshold_message(self): | 158 def test_below_threshold_message(self): |
| 157 self._log.log(self._level - 1, "test message") | 159 self._log.log(self._level - 1, "test message") |
| 158 self._assert_log_messages([]) | 160 self._assert_log_messages([]) |
| OLD | NEW |