code: def test_inheritance(start_cluster, option: str):
      """Tests that child tasks/actors inherit URIs properly."""
      cluster, address = start_cluster
      with tempfile.TemporaryDirectory() as tmpdir, chdir(tmpdir):
          with open("hello", "w") as f:
              f.write("world")
  
          if option == "working_dir":
              ray.init(address, runtime_env={"working_dir": "."})
          elif option == "py_modules":
              ray.init(address, runtime_env={"py_modules": ["."]})
  
          @ray.remote
          def get_env():
              return ray.get_runtime_context().runtime_env
  
          @ray.remote
          class EnvGetter:
              def get(self):
                  return ray.get_runtime_context().runtime_env
  
          job_env = ray.get_runtime_context().runtime_env
          assert ray.get(get_env.remote()) == job_env
          eg = EnvGetter.remote()
          assert ray.get(eg.get.remote()) == job_env
  
          # Passing a new URI should work.
          if option == "working_dir":
              env = {"working_dir": S3_PACKAGE_URI}
          elif option == "py_modules":
              env = {"py_modules": [S3_PACKAGE_URI]}
  
          new_env = ray.get(get_env.options(runtime_env=env).remote())
          assert new_env != job_env
          eg = EnvGetter.options(runtime_env=env).remote()
          assert ray.get(eg.get.remote()) != job_env
  
          # Passing a local directory should not work.
          if option == "working_dir":
              env = {"working_dir": "."}
          elif option == "py_modules":
              env = {"py_modules": ["."]}
          with pytest.raises(ValueError):
              get_env.options(runtime_env=env).remote()
          with pytest.raises(ValueError):
              EnvGetter.options(runtime_env=env).remote()
  
file_path: ray/python/ray/tests/test_runtime_env_working_dir_2.py
imports: import os
  from pathlib import Path
  import sys
  import tempfile
  import pytest
  from ray._private.test_utils import chdir, run_string_as_driver
  import ray
  from ray._private.runtime_env import RAY_WORKER_DEV_EXCLUDES
  from ray._private.runtime_env.packaging import GCS_STORAGE_MAX_SIZE
  from ray.exceptions import RuntimeEnvSetupError
  from ray._private.runtime_env.packaging import get_uri_for_directory, upload_package_if_needed
  from ray._private.utils import get_directory_size_bytes
label_desc: Use image node_id 1 for calling a global function with example usage: test_inheritance(start_cluster, option) and returns: ray, ray