code: def _update_current_test_var(item, when):
      """
      Update PYTEST_CURRENT_TEST to reflect the current item and stage.
  
      If ``when`` is None, delete PYTEST_CURRENT_TEST from the environment.
      """
      var_name = "PYTEST_CURRENT_TEST"
      if when:
          value = "{} ({})".format(item.nodeid, when)
          # don't allow null bytes on environment variables (see #2644, #2957)
          value = value.replace("\x00", "(null)")
          os.environ[var_name] = value
      else:
          os.environ.pop(var_name)
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import bdb
  import os
  import sys
  from time import time
  import attr
  import six
  from .reports import CollectErrorRepr
  from .reports import CollectReport
  from .reports import TestReport
  from _pytest._code.code import ExceptionInfo
  from _pytest.compat import safe_str
  from _pytest.outcomes import Exit
  from _pytest.outcomes import Skipped
  from _pytest.outcomes import TEST_OUTCOME
label_desc: Use image node_id 11 for calling a global function with example usage: _update_current_test_var(item, when) without return types