Fix unit tests (#1630)

exception raised from `logging` module was breaking pytest
This commit is contained in:
Alexander Kukushkin
2020-07-30 10:33:31 +02:00
committed by GitHub
parent bfbc4860d5
commit b3c69b5fb2
+2 -1
View File
@@ -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'])