code: def test_detached_warning(shutdown_only):
      ray.init()
  
      @ray.remote
      class DetachedActor:
          def ping(self):
              return "pong"
  
      error_pubsub = init_error_pubsub()
      actor = DetachedActor.options(  # noqa: F841
          name="Pinger", lifetime="detached"
      ).remote()
      errors = get_error_message(error_pubsub, 1, None)
      error = errors.pop()
      assert (
          error["type"]
          == ray_constants.DETACHED_ACTOR_ANONYMOUS_NAMESPACE_ERROR
      )
  
file_path: ray/python/ray/tests/test_namespace.py
imports: import sys
  import time
  import pytest
  import ray
  from ray._private import ray_constants
  from ray._private.test_utils import get_error_message, init_error_pubsub, run_string_as_driver
  from ray.cluster_utils import Cluster
label_desc: Use image node_id 5 for calling a global function with example usage: test_detached_warning(shutdown_only) and returns: str