code: def test_warningiserror(app, status, warning):
      logging.setup(app, status, warning)
      logger = logging.getLogger(__name__)
  
      # if False, warning is not error
      app.warningiserror = False
      logger.warning("message")
  
      # if True, warning raises SphinxWarning exception
      app.warningiserror = True
      with pytest.raises(SphinxWarning):
          logger.warning("message: %s", "arg")
  
      # message contains format string (refs: #4070)
      with pytest.raises(SphinxWarning):
          logger.warning("%s")
  
imports: import codecs
  import os
  import os.path
  import pytest
  from docutils import nodes
  from sphinx.errors import SphinxWarning
  from sphinx.testing.util import strip_escseq
  from sphinx.util import logging, osutil
  from sphinx.util.console import colorize
  from sphinx.util.logging import is_suppressed_warning, prefixed_warnings
  from sphinx.util.parallel import ParallelTasks
label_desc: Use image node_id 8 for calling a global function with example usage: test_warningiserror(app, status, warning) without return types