docstr: Tests that actor-level working_dir is GC'd when the actor exits.
docstr_tok: ["Tests","that","actor-level","working_dir","is","GC","'d","when","the","actor","exits","."]
code: def test_actor_level_gc(
      self,
      runtime_env_disable_URI_cache,
      start_cluster,
      field,
      spec_format,
      tmp_path,
  ):
      """Tests that actor-level working_dir is GC'd when the actor exits."""
      cluster, address = start_cluster
  
      ray.init(address)
  
      runtime_env = generate_runtime_env_dict(
          field, spec_format, tmp_path
      )
  
      @ray.remote
      class A:
          def test_import(self):
              import pip_install_test  # noqa: F401
  
              return True
  
      NUM_ACTORS = 5
      actors = [
          A.options(runtime_env=runtime_env).remote()
          for _ in range(NUM_ACTORS)
      ]
      ray.get([a.test_import.remote() for a in actors])
      for i in range(5):
          assert not check_local_files_gced(cluster)
          ray.kill(actors[i])
      wait_for_condition(
          lambda: check_local_files_gced(cluster), timeout=30
      )
  
file_path: ray/python/ray/tests/test_runtime_env_conda_and_pip_3.py
imports: import os
  import pytest
  import sys
  import time
  from ray._private.test_utils import wait_for_condition, check_local_files_gced, generate_runtime_env_dict
  import ray
  from unittest import mock
label_desc: Use image node_id 1 for calling the TestGC obj's underlying member method code with example usage: obj.test_actor_level_gc(runtime_env_disable_URI_cache, start_cluster, field, spec_format, tmp_path) and returns: True