ashb commented on code in PR #57744:
URL: https://github.com/apache/airflow/pull/57744#discussion_r2537421745
##########
task-sdk/src/airflow/sdk/definitions/dag.py:
##########
@@ -1171,23 +1172,32 @@ def test(
import re
import time
from contextlib import ExitStack
+ from unittest.mock import patch
from airflow import settings
- from airflow.configuration import secrets_backend_list
from airflow.models.dagrun import DagRun, get_or_create_dagrun
from airflow.sdk import DagRunState, timezone
- from airflow.secrets.local_filesystem import LocalFilesystemBackend
from airflow.serialization.serialized_objects import SerializedDAG
from airflow.utils.types import DagRunTriggeredByType, DagRunType
exit_stack = ExitStack()
if conn_file_path or variable_file_path:
- local_secrets = LocalFilesystemBackend(
- variables_file_path=variable_file_path,
connections_file_path=conn_file_path
+ backend_kwargs = {}
+ if conn_file_path:
+ backend_kwargs["connections_file_path"] = conn_file_path
+ if variable_file_path:
+ backend_kwargs["variables_file_path"] = variable_file_path
+
+ exit_stack.enter_context(
+ patch.dict(
+ os.environ,
+ {
+ "AIRFLOW__SECRETS__BACKEND":
"airflow.secrets.local_filesystem.LocalFilesystemBackend",
+ "AIRFLOW__SECRETS__BACKEND_KWARGS":
json.dumps(backend_kwargs),
+ },
+ )
Review Comment:
What's this change for?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]