This is an automated email from the ASF dual-hosted git repository.
jedcunningham pushed a commit to branch v3-0-test
in repository https://gitbox.apache.org/repos/asf/airflow.git
The following commit(s) were added to refs/heads/v3-0-test by this push:
new 11b1cdea218 [v3-0-test] Fix AIRFLOW_API_APPS constant in
api_server_command (#54007) (#54012)
11b1cdea218 is described below
commit 11b1cdea21809d1ad3f5a7aae6ab7d4eed2c2f3a
Author: github-actions[bot]
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Fri Aug 1 11:48:54 2025 -0600
[v3-0-test] Fix AIRFLOW_API_APPS constant in api_server_command (#54007)
(#54012)
(cherry picked from commit d2449821512c81b828c5022d224b273f172384f6)
Co-authored-by: LIU ZHE YOU <[email protected]>
---
airflow-core/src/airflow/cli/commands/api_server_command.py | 9 ++++-----
airflow-core/tests/unit/cli/commands/test_api_server_command.py | 8 +++-----
2 files changed, 7 insertions(+), 10 deletions(-)
diff --git a/airflow-core/src/airflow/cli/commands/api_server_command.py
b/airflow-core/src/airflow/cli/commands/api_server_command.py
index 6ffc27519f2..7664143629e 100644
--- a/airflow-core/src/airflow/cli/commands/api_server_command.py
+++ b/airflow-core/src/airflow/cli/commands/api_server_command.py
@@ -38,7 +38,6 @@ from airflow.utils.providers_configuration_loader import
providers_configuration
PS = ParamSpec("PS")
RT = TypeVar("RT")
-AIRFLOW_API_APPS = "AIRFLOW_API_APPS"
log = logging.getLogger(__name__)
@@ -56,17 +55,17 @@ def with_api_apps_env(func: Callable[[Namespace], RT]) ->
Callable[[Namespace],
@wraps(func)
def wrapper(args: Namespace) -> RT:
apps: str = args.apps
- original_value = os.environ.get(AIRFLOW_API_APPS)
+ original_value = os.environ.get("AIRFLOW_API_APPS")
try:
log.debug("Setting AIRFLOW_API_APPS to: %s", apps)
- os.environ[AIRFLOW_API_APPS] = apps
+ os.environ["AIRFLOW_API_APPS"] = apps
return func(args)
finally:
if original_value is not None:
- os.environ[AIRFLOW_API_APPS] = original_value
+ os.environ["AIRFLOW_API_APPS"] = original_value
log.debug("Restored AIRFLOW_API_APPS to: %s", original_value)
else:
- os.environ.pop(AIRFLOW_API_APPS, None)
+ os.environ.pop("AIRFLOW_API_APPS", None)
log.debug("Removed AIRFLOW_API_APPS from environment")
return wrapper
diff --git a/airflow-core/tests/unit/cli/commands/test_api_server_command.py
b/airflow-core/tests/unit/cli/commands/test_api_server_command.py
index 23cc041e24b..8e9ce84fdc8 100644
--- a/airflow-core/tests/unit/cli/commands/test_api_server_command.py
+++ b/airflow-core/tests/unit/cli/commands/test_api_server_command.py
@@ -121,15 +121,13 @@ class TestCliApiServer(_CommonCLIGunicornTestClass):
# Verify the AIRFLOW_API_APPS was set correctly
if "--apps" in args:
- expected_setitem_calls.append(
- mock.call(api_server_command.AIRFLOW_API_APPS,
parsed_args.apps)
- )
+ expected_setitem_calls.append(mock.call("AIRFLOW_API_APPS",
parsed_args.apps))
# Verify AIRFLOW_API_APPS was cleaned up
if original_env is not None:
-
expected_setitem_calls.append(mock.call(api_server_command.AIRFLOW_API_APPS,
original_env))
+ expected_setitem_calls.append(mock.call("AIRFLOW_API_APPS",
original_env))
else:
-
mock_environ.pop.assert_called_with(api_server_command.AIRFLOW_API_APPS, None)
+ mock_environ.pop.assert_called_with("AIRFLOW_API_APPS", None)
# Verify that the environment variable was set and cleaned up
correctly
mock_environ.__setitem__.assert_has_calls(expected_setitem_calls)