code: def test_live_logging_suspends_capture(
      has_capture_manager: bool, request: FixtureRequest
  ) -> None:
      """Test that capture manager is suspended when we emitting messages for live logging.
  
      This tests the implementation calls instead of behavior because it is difficult/impossible to do it using
      ``pytester`` facilities because they do their own capturing.
  
      We parametrize the test to also make sure _LiveLoggingStreamHandler works correctly if no capture manager plugin
      is installed.
      """
      import logging
      import contextlib
      from functools import partial
      from _pytest.logging import _LiveLoggingStreamHandler
  
      class MockCaptureManager:
          calls = []
  
          @contextlib.contextmanager
          def global_and_fixture_disabled(self):
              self.calls.append("enter disabled")
              yield
              self.calls.append("exit disabled")
  
      class DummyTerminal(io.StringIO):
          def section(self, *args, **kwargs):
              pass
  
      out_file = cast(TerminalReporter, DummyTerminal())
      capture_manager = (
          cast(CaptureManager, MockCaptureManager())
          if has_capture_manager
          else None
      )
      handler = _LiveLoggingStreamHandler(out_file, capture_manager)
      handler.set_when("call")
  
      logger = logging.getLogger(
          __name__ + ".test_live_logging_suspends_capture"
      )
      logger.addHandler(handler)
      request.addfinalizer(partial(logger.removeHandler, handler))
  
      logger.critical("some message")
      if has_capture_manager:
          assert MockCaptureManager.calls == [
              "enter disabled",
              "exit disabled",
          ]
      else:
          assert MockCaptureManager.calls == []
      assert (
          cast(io.StringIO, out_file).getvalue() == "\nsome message\n"
      )
  
imports: import io
  import os
  import re
  from typing import cast
  import pytest
  from _pytest.capture import CaptureManager
  from _pytest.config import ExitCode
  from _pytest.fixtures import FixtureRequest
  from _pytest.pytester import Pytester
  from _pytest.terminal import TerminalReporter
label_desc: Use image node_id 22 for calling a global function with example usage: test_live_logging_suspends_capture(has_capture_manager, request) without return types