code: def testSettingsOverrideEnv(self):
      settings = get_default_settings()
  
      # With no environment variables, default settings shouldn't be updated
      updated_settings = settings.copy()
      update_settings_from_environment(updated_settings)
  
      self.assertDictEqual(settings, updated_settings)
  
      environ = os.environ.copy()
  
      # Invalid frequency
      os.environ.clear()
      os.environ.update(environ)
      os.environ["RELEASE_FREQUENCY"] = "invalid"
      updated_settings = settings.copy()
      with self.assertRaises(ReleaseTestConfigError):
          update_settings_from_environment(updated_settings)
  
      # Invalid priority
      os.environ.clear()
      os.environ.update(environ)
      os.environ["RELEASE_PRIORITY"] = "invalid"
      updated_settings = settings.copy()
      with self.assertRaises(ReleaseTestConfigError):
          update_settings_from_environment(updated_settings)
  
      # Invalid test attr regex filters
      os.environ.clear()
      os.environ.update(environ)
      os.environ["TEST_ATTR_REGEX_FILTERS"] = "xxxx"
      updated_settings = settings.copy()
      with self.assertRaises(ReleaseTestConfigError):
          update_settings_from_environment(updated_settings)
  
      os.environ.clear()
      os.environ.update(environ)
      os.environ["TEST_ATTR_REGEX_FILTERS"] = "name:xxx\nteam:yyy\n"
      updated_settings = settings.copy()
      update_settings_from_environment(updated_settings)
      self.assertDictEqual(
          updated_settings["test_attr_regex_filters"],
          {
              "name": "xxx",
              "team": "yyy",
          },
      )
  
      os.environ.clear()
      os.environ.update(environ)
      os.environ["RELEASE_FREQUENCY"] = "nightly"
      os.environ["RAY_TEST_REPO"] = "https://github.com/user/ray.git"
      os.environ["RAY_TEST_BRANCH"] = "sub/branch"
      os.environ["RAY_WHEELS"] = "custom-wheels"
      os.environ["TEST_NAME"] = "name_filter"
      os.environ["RELEASE_PRIORITY"] = "manual"
      updated_settings = settings.copy()
      update_settings_from_environment(updated_settings)
  
      self.assertDictEqual(
          updated_settings,
          {
              "frequency": Frequency.NIGHTLY,
              "prefer_smoke_tests": False,
              "test_attr_regex_filters": {"name": "name_filter"},
              "ray_wheels": "custom-wheels",
              "ray_test_repo": "https://github.com/user/ray.git",
              "ray_test_branch": "sub/branch",
              "priority": Priority.MANUAL,
              "no_concurrency_limit": False,
          },
      )
  
      os.environ["RELEASE_FREQUENCY"] = "any-smoke"
      update_settings_from_environment(updated_settings)
      self.assertDictEqual(
          updated_settings,
          {
              "frequency": Frequency.ANY,
              "prefer_smoke_tests": True,
              "test_attr_regex_filters": {"name": "name_filter"},
              "ray_wheels": "custom-wheels",
              "ray_test_repo": "https://github.com/user/ray.git",
              "ray_test_branch": "sub/branch",
              "priority": Priority.MANUAL,
              "no_concurrency_limit": False,
          },
      )
  
      ###
      # Buildkite PR build settings
  
      # Default PR
      os.environ.clear()
      os.environ.update(environ)
      os.environ[
          "BUILDKITE_REPO"
      ] = "https://github.com/ray-project/ray.git"
      os.environ[
          "BUILDKITE_PULL_REQUEST_REPO"
      ] = "https://github.com/user/ray-fork.git"
      os.environ["BUILDKITE_BRANCH"] = "user:some_branch"
      updated_settings = settings.copy()
      update_settings_from_environment(updated_settings)
  
      self.assertEqual(
          updated_settings["ray_test_repo"],
          "https://github.com/user/ray-fork.git",
      )
      self.assertEqual(
          updated_settings["ray_test_branch"], "some_branch"
      )
  
      # PR without prefix
      os.environ.clear()
      os.environ.update(environ)
      os.environ[
          "BUILDKITE_REPO"
      ] = "https://github.com/ray-project/ray.git"
      os.environ[
          "BUILDKITE_PULL_REQUEST_REPO"
      ] = "git://github.com/user/ray-fork.git"
      os.environ["BUILDKITE_BRANCH"] = "some_branch"
      updated_settings = settings.copy()
      update_settings_from_environment(updated_settings)
  
      self.assertEqual(
          updated_settings["ray_test_repo"],
          "https://github.com/user/ray-fork.git",
      )
      self.assertEqual(
          updated_settings["ray_test_branch"], "some_branch"
      )
  
      # Branch build but pointing to fork
      os.environ.clear()
      os.environ.update(environ)
      os.environ[
          "BUILDKITE_REPO"
      ] = "https://github.com/ray-project/ray.git"
      os.environ["BUILDKITE_BRANCH"] = "user:some_branch"
      updated_settings = settings.copy()
      update_settings_from_environment(updated_settings)
  
      self.assertEqual(
          updated_settings["ray_test_repo"],
          "https://github.com/user/ray.git",
      )
      self.assertEqual(
          updated_settings["ray_test_branch"], "some_branch"
      )
  
      # Branch build but pointing to main repo branch
      os.environ.clear()
      os.environ.update(environ)
      os.environ[
          "BUILDKITE_REPO"
      ] = "https://github.com/ray-project/ray.git"
      os.environ["BUILDKITE_BRANCH"] = "some_branch"
      updated_settings = settings.copy()
      update_settings_from_environment(updated_settings)
  
      self.assertEqual(
          updated_settings["ray_test_repo"],
          "https://github.com/ray-project/ray.git",
      )
      self.assertEqual(
          updated_settings["ray_test_branch"], "some_branch"
      )
  
      # Empty BUILDKITE_PULL_REQUEST_REPO
      os.environ.clear()
      os.environ.update(environ)
      os.environ[
          "BUILDKITE_REPO"
      ] = "https://github.com/ray-project/ray.git"
      os.environ["BUILDKITE_BRANCH"] = "some_branch"
      os.environ["BUILDKITE_PULL_REQUEST_REPO"] = ""
      updated_settings = settings.copy()
      update_settings_from_environment(updated_settings)
  
      self.assertEqual(
          updated_settings["ray_test_repo"],
          "https://github.com/ray-project/ray.git",
      )
      self.assertEqual(
          updated_settings["ray_test_branch"], "some_branch"
      )
  
imports: import os
  import sys
  import tempfile
  import unittest
  from typing import Dict, Callable
  from unittest.mock import patch
  import yaml
  from github import Repository
  from ray_release.buildkite.concurrency import get_test_resources_from_cluster_compute, get_concurrency_group
  from ray_release.buildkite.filter import filter_tests, group_tests
  from ray_release.buildkite.settings import split_ray_repo_str, get_default_settings, update_settings_from_environment, Frequency, update_settings_from_buildkite, Priority, get_test_attr_regex_filters
  from ray_release.buildkite.step import get_step, RELEASE_QUEUE_DEFAULT, RELEASE_QUEUE_CLIENT, DOCKER_PLUGIN_KEY
  from ray_release.test import Test
  from ray_release.exception import ReleaseTestConfigError
  from ray_release.wheels import DEFAULT_BRANCH
label_desc: Use image node_id 4 for calling the BuildkiteSettingsTest obj's underlying member method code with example usage: obj.testSettingsOverrideEnv() without return types