diff options
| author | 2023-04-12 15:21:53 +0100 | |
|---|---|---|
| committer | 2023-04-12 15:21:53 +0100 | |
| commit | cd420dade00b253bc7d458a2480748a55668591a (patch) | |
| tree | db171434ffe1e3872e3f6a83c56f9ea6a8ac8806 /tests/test_base.py | |
| parent | Fix deleted message logging in mod alert (diff) | |
| parent | Merge pull request #2523 from python-discord/flake8-to-ruff (diff) | |
Merge branch 'main' into fix_alert_message_logging
Diffstat (limited to '')
| -rw-r--r-- | tests/test_base.py | 21 | 
1 files changed, 12 insertions, 9 deletions
| diff --git a/tests/test_base.py b/tests/test_base.py index 365805a71..f1fb1a514 100644 --- a/tests/test_base.py +++ b/tests/test_base.py @@ -30,15 +30,19 @@ class LoggingTestCaseTests(unittest.TestCase):              r"1 logs of DEBUG or higher were triggered on root:\n"              r'<LogRecord: tests\.test_base, [\d]+, .+[/\\]tests[/\\]test_base\.py, [\d]+, "Log!">'          ) -        with self.assertRaisesRegex(AssertionError, msg_regex): -            with LoggingTestCase.assertNotLogs(self, level=logging.DEBUG): -                self.log.debug("Log!") +        with ( +            self.assertRaisesRegex(AssertionError, msg_regex), +            LoggingTestCase.assertNotLogs(self, level=logging.DEBUG), +        ): +            self.log.debug("Log!")      def test_assert_not_logs_reraises_unexpected_exception_in_managed_context(self):          """Test if LoggingTestCase.assertNotLogs reraises an unexpected exception.""" -        with self.assertRaises(ValueError, msg="test exception"): -            with LoggingTestCase.assertNotLogs(self, level=logging.DEBUG): -                raise ValueError("test exception") +        with ( +            self.assertRaises(ValueError, msg="test exception"), +            LoggingTestCase.assertNotLogs(self, level=logging.DEBUG), +        ): +            raise ValueError("test exception")      def test_assert_not_logs_restores_old_logging_settings(self):          """Test if LoggingTestCase.assertNotLogs reraises an unexpected exception.""" @@ -56,9 +60,8 @@ class LoggingTestCaseTests(unittest.TestCase):      def test_logging_test_case_works_with_logger_instance(self):          """Test if the LoggingTestCase captures logging for provided logger."""          log = get_logger("new_logger") -        with self.assertRaises(AssertionError): -            with LoggingTestCase.assertNotLogs(self, logger=log): -                log.info("Hello, this should raise an AssertionError") +        with self.assertRaises(AssertionError), 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.""" | 
