openai-agents-python/tests/test_test_environment.py
dependabot[bot] 9d2b318dd0
fix(deps-dev): bump ruff from 0.9.2 to 0.16.8 (#5249)
* fix(deps-dev): bump ruff from 0.9.2 to 0.16.8

Bumps [ruff](https://github.com/astral-sh/ruff) from 0.9.2 to 0.16.8.
- [Release notes](https://github.com/astral-sh/ruff/releases)
- [Changelog](https://github.com/astral-sh/ruff/blob/main/CHANGELOG.md)
- [Commits](https://github.com/astral-sh/ruff/compare/0.9.2...0.16.8)

---
updated-dependencies:
- dependency-name: ruff
  dependency-version: 0.16.8
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

* fix: apply Ruff 0.16.8 formatting and lint updates

* fix: exclude generated translations from Ruff formatting

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Justin Beckwith <jbeckwith@openai.com>
2026-09-30 22:24:21 +00:00

33 lines
1 KiB
Python

from __future__ import annotations
import pytest
from .conftest import (
_PROXY_ENVIRONMENT_VARIABLES,
_PROXY_OPT_IN_ENVIRONMENT_VARIABLE,
_remove_ambient_proxy_environment,
)
def test_remove_ambient_proxy_environment_clears_proxy_variables() -> None:
environment = dict.fromkeys(_PROXY_ENVIRONMENT_VARIABLES, "socks5h://127.0.0.1:1234")
environment["UNRELATED"] = "preserved"
_remove_ambient_proxy_environment(environment)
assert all(variable not in environment for variable in _PROXY_ENVIRONMENT_VARIABLES)
assert environment["UNRELATED"] == "preserved"
@pytest.mark.parametrize("opt_in", ["1", "true", "TRUE", "yes", "YES"])
def test_remove_ambient_proxy_environment_preserves_proxy_variables_when_opted_in(
opt_in: str,
) -> None:
environment = {
_PROXY_OPT_IN_ENVIRONMENT_VARIABLE: opt_in,
"ALL_PROXY": "socks5h://127.0.0.1:1234",
}
_remove_ambient_proxy_environment(environment)
assert environment["ALL_PROXY"] == "socks5h://127.0.0.1:1234"