code: def test_inherit_cluster_env_pythonpath(monkeypatch):
      monkeypatch.setenv(
          "PYTHONPATH",
          "last" + os.pathsep + os.environ.get("PYTHONPATH", ""),
      )
      context = RuntimeEnvContext(env_vars={"PYTHONPATH": "middle"})
  
      set_pythonpath_in_context("first", context)
  
      assert context.env_vars["PYTHONPATH"].startswith(
          os.pathsep.join(["first", "middle", "last"])
      )
  
imports: import os
  import shutil
  import sys
  import tempfile
  import time
  from importlib import import_module
  from pathlib import Path
  from unittest import mock
  import pytest
  import ray
  from ray._private import gcs_utils
  from ray._private.runtime_env.context import RuntimeEnvContext
  from ray._private.runtime_env.packaging import get_uri_for_directory, upload_package_if_needed
  from ray._private.runtime_env.working_dir import WorkingDirPlugin, set_pythonpath_in_context
  from ray._private.utils import get_directory_size_bytes
label_desc: Use image node_id 2 for calling a global function with example usage: test_inherit_cluster_env_pythonpath(monkeypatch) without return types