code: def test_runtime_env_override(call_ray_start):
      # https://github.com/ray-project/ray/issues/16481
  
      with tempfile.TemporaryDirectory() as tmpdir, chdir(tmpdir):
          ray.init(address="auto", namespace="test")
  
          @ray.remote
          class Child:
              def getcwd(self):
                  import os
  
                  return os.getcwd()
  
              def read(self, path):
                  return open(path).read()
  
              def ready(self):
                  pass
  
          @ray.remote
          class Parent:
              def spawn_child(self, name, runtime_env):
                  child = Child.options(
                      lifetime="detached",
                      name=name,
                      runtime_env=runtime_env,
                  ).remote()
                  ray.get(child.ready.remote())
  
          Parent.options(lifetime="detached", name="parent").remote()
          ray.shutdown()
  
          with open("hello", "w") as f:
              f.write("world")
  
          job_config = ray.job_config.JobConfig(
              runtime_env={"working_dir": "."}
          )
          ray.init(
              address="auto", namespace="test", job_config=job_config
          )
  
          os.remove("hello")
  
          parent = ray.get_actor("parent")
  
          env = ray.get_runtime_context().runtime_env
          print("Spawning with env:", env)
          ray.get(parent.spawn_child.remote("child", env))
  
          child = ray.get_actor("child")
          child_cwd = ray.get(child.getcwd.remote())
          # Child should be in tmp runtime resource dir.
          assert child_cwd != os.getcwd(), (child_cwd, os.getcwd())
          assert ray.get(child.read.remote("hello")) == "world"
  
          ray.shutdown()
  
imports: import os
  import platform
  from pathlib import Path
  import pytest
  import subprocess
  import sys
  import tempfile
  import time
  from typing import List
  from unittest import mock
  import yaml
  import ray
  from ray.runtime_env import RuntimeEnv
  from ray._private.runtime_env.conda import inject_dependencies, _inject_ray_to_conda_site, _resolve_install_from_source_ray_dependencies, _current_py_version
  from ray._private.runtime_env.conda_utils import get_conda_env_list
  from ray._private.test_utils import run_string_as_driver, run_string_as_driver_nonblocking, wait_for_condition, chdir
  from ray._private.utils import get_conda_env_dir, get_conda_bin_executable, try_to_create_directory
label_desc: Use image node_id 24 for calling a global function with example usage: test_runtime_env_override(call_ray_start) and returns: os, open