From b3c69b5fb2cdd6d582409e076f8b1648cb18679e Mon Sep 17 00:00:00 2001 From: Alexander Kukushkin Date: Thu, 30 Jul 2020 10:33:31 +0200 Subject: [PATCH] Fix unit tests (#1630) exception raised from `logging` module was breaking pytest --- tests/test_log.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/test_log.py b/tests/test_log.py index 613d18cd..96dc0a3f 100644 --- a/tests/test_log.py +++ b/tests/test_log.py @@ -43,7 +43,8 @@ class TestPatroniLogger(unittest.TestCase): _LOG.exception('test') logger.start() - with patch.object(logging.Handler, 'format', Mock(side_effect=Exception)): + with patch.object(logging.Handler, 'format', Mock(side_effect=Exception)),\ + patch('_pytest.logging.LogCaptureHandler.emit', Mock()): logging.error('test') self.assertEqual(logger.log_handler.maxBytes, config['log']['file_size'])