| 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 28 matching lines...) Expand all Loading... |
| 39 logger = logutils.get_logger(__file__) | 39 logger = logutils.get_logger(__file__) |
| 40 self.assertEqual(logger.name, "webkitpy.common.system.logutils_unittest"
) | 40 self.assertEqual(logger.name, "webkitpy.common.system.logutils_unittest"
) |
| 41 | 41 |
| 42 def test_get_logger_not_in_webkitpy(self): | 42 def test_get_logger_not_in_webkitpy(self): |
| 43 # Temporarily change the working directory so that we | 43 # Temporarily change the working directory so that we |
| 44 # can test get_logger() for a path outside of webkitpy. | 44 # can test get_logger() for a path outside of webkitpy. |
| 45 working_directory = os.getcwd() | 45 working_directory = os.getcwd() |
| 46 root_dir = "/" | 46 root_dir = "/" |
| 47 os.chdir(root_dir) | 47 os.chdir(root_dir) |
| 48 | 48 |
| 49 logger = logutils.get_logger("/Tools/Scripts/test-webkitpy") | 49 logger = logutils.get_logger("/tools/test-webkitpy") |
| 50 self.assertEqual(logger.name, "test-webkitpy") | 50 self.assertEqual(logger.name, "test-webkitpy") |
| 51 | 51 |
| 52 logger = logutils.get_logger("/Tools/Scripts/test-webkitpy.py") | 52 logger = logutils.get_logger("/tools/test-webkitpy.py") |
| 53 self.assertEqual(logger.name, "test-webkitpy") | 53 self.assertEqual(logger.name, "test-webkitpy") |
| 54 | 54 |
| 55 os.chdir(working_directory) | 55 os.chdir(working_directory) |
| 56 | 56 |
| 57 | 57 |
| 58 class ConfigureLoggingTestBase(unittest.TestCase): | 58 class ConfigureLoggingTestBase(unittest.TestCase): |
| 59 | 59 |
| 60 """Base class for configure_logging() unit tests.""" | 60 """Base class for configure_logging() unit tests.""" |
| 61 | 61 |
| 62 def _logging_level(self): | 62 def _logging_level(self): |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 def _logging_level(self): | 149 def _logging_level(self): |
| 150 return self._level | 150 return self._level |
| 151 | 151 |
| 152 def test_logged_message(self): | 152 def test_logged_message(self): |
| 153 self._log.log(self._level, "test message") | 153 self._log.log(self._level, "test message") |
| 154 self._assert_log_messages(["test message\n"]) | 154 self._assert_log_messages(["test message\n"]) |
| 155 | 155 |
| 156 def test_below_threshold_message(self): | 156 def test_below_threshold_message(self): |
| 157 self._log.log(self._level - 1, "test message") | 157 self._log.log(self._level - 1, "test message") |
| 158 self._assert_log_messages([]) | 158 self._assert_log_messages([]) |
| OLD | NEW |