code: def pytest_cmdline_parse():
      outcome = yield
      config = outcome.get_result()
      if config.option.debug:
          path = os.path.abspath("pytestdebug.log")
          debugfile = open(path, "w")
          debugfile.write(
              "versions pytest-%s, py-%s, "
              "python-%s\ncwd=%s\nargs=%s\n\n"
              % (
                  pytest.__version__,
                  py.__version__,
                  ".".join(map(str, sys.version_info)),
                  os.getcwd(),
                  config._origargs,
              )
          )
          config.trace.root.setwriter(debugfile.write)
          undo_tracing = config.pluginmanager.enable_tracing()
          sys.stderr.write(
              "writing pytestdebug information to %s\n" % path
          )
  
          def unset_tracing():
              debugfile.close()
              sys.stderr.write(
                  "wrote pytestdebug information to %s\n"
                  % debugfile.name
              )
              config.trace.root.setwriter(None)
              undo_tracing()
  
          config.add_cleanup(unset_tracing)
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import os
  import sys
  from argparse import Action
  import py
  import pytest
  from _pytest.config import PrintHelp
label_desc: Use image node_id 2 for calling a global function with example usage: pytest_cmdline_parse() without return types