Avoid locking in the logging queue handler (#35700)
* Avoid locking in the logging queue handler We do not need a lock here as the underlying queue is already thread safe. * Add coverage for logging handle
This commit is contained in:
1 parent
65e509ed8f
commit
1297a09344
2 files changed
+29
No files matched your search
@@ -38,6 +38,17 @@ async def test_logging_with_queue_handler():
|
||||
):
|
||||
handler.emit(log_record)
|
||||
|
||||
with patch.object(handler, "emit") as emit_mock:
|
||||
handler.handle(log_record)
|
||||
emit_mock.assert_called_once()
|
||||
|
||||
with patch.object(handler, "filter") as filter_mock, patch.object(
|
||||
handler, "emit"
|
||||
) as emit_mock:
|
||||
filter_mock.return_value = False
|
||||
handler.handle(log_record)
|
||||
emit_mock.assert_not_called()
|
||||
|
||||
with patch.object(handler, "enqueue", side_effect=OSError), patch.object(
|
||||
handler, "handleError"
|
||||
) as mock_handle_error:
|
||||
|
||||
Reference in new issue
Block a user