code: def test_logger_with_lock_does_not_cause_deadlock(self):
      stream = StringIO()
      mock_run = MagicMock()
      attr_name = "sys/stdout"
  
      logger = StdStreamCaptureLogger(mock_run, attr_name, stream)
      done_waiting = threading.Event()
      logger._logger = FakeLogger(done_waiting, logger._logger)
  
      # The logger is blocked in background, the main thread is still awake
      logger.write("testing")
      self.assertListEqual(
          mock_run[attr_name].log.call_args_list,
          [],
      )
  
      done_waiting.set()
      logger.close()
      self.assertListEqual(
          mock_run[attr_name].log.call_args_list,
          [
              (("testing",), {}),
          ],
      )
      stream.seek(0)
      self.assertEqual(stream.read(), "testing")
  
file_path: neptune-client/tests/unit/neptune/new/internal/test_streams.py
imports: import sys
  import threading
  import unittest
  from contextlib import redirect_stdout
  from io import StringIO
  from unittest.mock import MagicMock
  from neptune.internal.streams.std_stream_capture_logger import StdoutCaptureLogger, StdStreamCaptureLogger
  from neptune.logging import Logger
label_desc: Use image node_id 3 for calling the TestStdStreamCaptureLogger obj's underlying member method code with example usage: obj.test_logger_with_lock_does_not_cause_deadlock() without return types