docstr: Check if the general Ray runtime_env inheritance behavior matches.
  
  override_runtime_envs_except_env_vars should match the general Ray
  runtime_env inheritance behavior. This test checks if that behavior
  has changed, which would indicate a regression in
  override_runtime_envs_except_env_vars. If the runtime_env inheritance
  behavior changes, override_runtime_envs_except_env_vars should also
  change to match.
code: def test_inheritance_regression(self):
      """Check if the general Ray runtime_env inheritance behavior matches.
  
      override_runtime_envs_except_env_vars should match the general Ray
      runtime_env inheritance behavior. This test checks if that behavior
      has changed, which would indicate a regression in
      override_runtime_envs_except_env_vars. If the runtime_env inheritance
      behavior changes, override_runtime_envs_except_env_vars should also
      change to match.
      """
  
      with ray.init(
          runtime_env={
              "py_modules": [TEST_DAG_PINNED_URI],
              "env_vars": {"var1": "hello"},
          }
      ):
  
          @ray.remote
          def check_module():
              # Check that Ray job's py_module loaded correctly
              from conditional_dag import serve_dag  # noqa: F401
  
              return os.getenv("var1")
  
          assert ray.get(check_module.remote()) == "hello"
  
          @ray.remote(
              runtime_env={
                  "py_modules": [TEST_DEPLOY_GROUP_PINNED_URI],
                  "env_vars": {"var2": "world"},
              }
          )
          def test_task():
              with pytest.raises(ImportError):
                  # Check that Ray job's py_module was overwritten
                  from conditional_dag import serve_dag  # noqa: F401
  
              from test_env.shallow_import import ShallowClass
  
              if ShallowClass()() == "Hello shallow world!":
                  return os.getenv("var1") + " " + os.getenv("var2")
  
          assert ray.get(test_task.remote()) == "hello world"
  
imports: import asyncio
  import json
  import os
  import time
  from unittest.mock import patch
  import numpy
  import pytest
  from fastapi.encoders import jsonable_encoder
  import ray
  from ray import serve
  from ray._private.resource_spec import HEAD_NODE_RESOURCE_NAME
  from ray._private.test_utils import wait_for_condition
  from ray.serve._private.test_utils import MockTimer
  from ray.serve._private.utils import MetricsPusher, calculate_remaining_timeout, get_all_live_placement_group_names, get_current_actor_id, get_head_node_id, is_running_in_asyncio_loop, merge_dict, msgpack_deserialize, msgpack_serialize, override_runtime_envs_except_env_vars, serve_encoders, snake_to_camel_case
  from ray.serve.tests.common.remote_uris import TEST_DAG_PINNED_URI, TEST_DEPLOY_GROUP_PINNED_URI
label_desc: Use image node_id 9 for calling the TestOverrideRuntimeEnvsExceptEnvVars obj's underlying member method code with example usage: obj.test_inheritance_regression() and returns: os, unknown