diff options
| author | 2021-10-17 13:41:37 +0100 | |
|---|---|---|
| committer | 2021-10-17 13:41:37 +0100 | |
| commit | 0231712beb90462b8a95074d6d275774054a39a8 (patch) | |
| tree | 3d2f326ae21133eb52e8dea09515486d2d469189 /tests/test_base.py | |
| parent | Update infraction DM tests to reflect new output (diff) | |
| parent | Merge pull request #1882 from python-discord/fix-attr-error (diff) | |
Merge branch 'main' into new-appeals-process
Diffstat (limited to '')
| -rw-r--r-- | tests/test_base.py | 11 | 
1 files changed, 5 insertions, 6 deletions
diff --git a/tests/test_base.py b/tests/test_base.py index a7db4bf3e..365805a71 100644 --- a/tests/test_base.py +++ b/tests/test_base.py @@ -1,8 +1,7 @@  import logging -import unittest  import unittest.mock - +from bot.log import get_logger  from tests.base import LoggingTestsMixin, _CaptureLogHandler @@ -15,7 +14,7 @@ class LoggingTestCaseTests(unittest.TestCase):      @classmethod      def setUpClass(cls): -        cls.log = logging.getLogger(__name__) +        cls.log = get_logger(__name__)      def test_assert_not_logs_does_not_raise_with_no_logs(self):          """Test if LoggingTestCase.assertNotLogs does not raise when no logs were emitted.""" @@ -56,15 +55,15 @@ class LoggingTestCaseTests(unittest.TestCase):      def test_logging_test_case_works_with_logger_instance(self):          """Test if the LoggingTestCase captures logging for provided logger.""" -        log = logging.getLogger("new_logger") +        log = get_logger("new_logger")          with self.assertRaises(AssertionError):              with LoggingTestCase.assertNotLogs(self, logger=log):                  log.info("Hello, this should raise an AssertionError")      def test_logging_test_case_respects_alternative_logger(self):          """Test if LoggingTestCase only checks the provided logger.""" -        log_one = logging.getLogger("log one") -        log_two = logging.getLogger("log two") +        log_one = get_logger("log one") +        log_two = get_logger("log two")          with LoggingTestCase.assertNotLogs(self, logger=log_one):              log_two.info("Hello, this should not raise an AssertionError")  |