This is an automated email from the ASF dual-hosted git repository.
amoghdesai pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git
The following commit(s) were added to refs/heads/main by this push:
new dc84ec99e85 Nuke patched_secrets_masker fixture and its usages (#54884)
dc84ec99e85 is described below
commit dc84ec99e85b8336fc1e3e7f09a8ccd67d963394
Author: Amogh Desai <[email protected]>
AuthorDate: Wed Sep 3 21:53:41 2025 +0530
Nuke patched_secrets_masker fixture and its usages (#54884)
---
task-sdk/tests/conftest.py | 10 ----------
task-sdk/tests/task_sdk/definitions/test_connections.py | 2 +-
task-sdk/tests/task_sdk/definitions/test_variables.py | 12 ++++--------
task-sdk/tests/task_sdk/execution_time/test_supervisor.py | 1 -
4 files changed, 5 insertions(+), 20 deletions(-)
diff --git a/task-sdk/tests/conftest.py b/task-sdk/tests/conftest.py
index c539a8c5848..82b46179092 100644
--- a/task-sdk/tests/conftest.py
+++ b/task-sdk/tests/conftest.py
@@ -20,7 +20,6 @@ import logging
import os
from pathlib import Path
from typing import TYPE_CHECKING, Any, NoReturn, Protocol
-from unittest.mock import patch
import pytest
@@ -273,12 +272,3 @@ def make_ti_context_dict(make_ti_context:
MakeTIContextCallable) -> MakeTIContex
return context.model_dump(exclude_unset=True, mode="json")
return _make_context_dict
-
-
[email protected]
-def patched_secrets_masker():
- from airflow.sdk._shared.secrets_masker import SecretsMasker
-
- secrets_masker = SecretsMasker()
- with patch("airflow.sdk._shared.secrets_masker._secrets_masker",
return_value=secrets_masker):
- yield secrets_masker
diff --git a/task-sdk/tests/task_sdk/definitions/test_connections.py
b/task-sdk/tests/task_sdk/definitions/test_connections.py
index 7967bdc3695..05a80f59c7c 100644
--- a/task-sdk/tests/task_sdk/definitions/test_connections.py
+++ b/task-sdk/tests/task_sdk/definitions/test_connections.py
@@ -207,7 +207,7 @@ class TestConnections:
):
Connection.from_json(json.dumps(json_data), conn_id="test_conn")
- def test_extra_dejson_property(self, patched_secrets_masker):
+ def test_extra_dejson_property(self):
"""Test that extra_dejson property correctly deserializes JSON extra
field."""
connection = Connection(
conn_id="test_conn",
diff --git a/task-sdk/tests/task_sdk/definitions/test_variables.py
b/task-sdk/tests/task_sdk/definitions/test_variables.py
index 0322060c217..c85924df6a6 100644
--- a/task-sdk/tests/task_sdk/definitions/test_variables.py
+++ b/task-sdk/tests/task_sdk/definitions/test_variables.py
@@ -91,7 +91,7 @@ class TestVariables:
class TestVariableFromSecrets:
- def test_var_get_from_secrets_found(self, mock_supervisor_comms,
patched_secrets_masker, tmp_path):
+ def test_var_get_from_secrets_found(self, mock_supervisor_comms, tmp_path):
"""Tests getting a variable from secrets backend."""
path = tmp_path / "var.env"
path.write_text("VAR_A=some_value")
@@ -109,9 +109,7 @@ class TestVariableFromSecrets:
assert retrieved_var is not None
assert retrieved_var == "some_value"
- def test_var_get_from_secrets_found_with_deserialize(
- self, mock_supervisor_comms, tmp_path, patched_secrets_masker
- ):
+ def test_var_get_from_secrets_found_with_deserialize(self,
mock_supervisor_comms, tmp_path):
"""Tests getting a variable from secrets backend when deserialize_json
is provided."""
path = tmp_path / "var.json"
dict_data = {"num1": 23, "num2": 42}
@@ -156,7 +154,7 @@ class TestVariableFromSecrets:
mock_mask_secret.assert_called_with("super-secret", "secret")
@mock.patch("airflow.secrets.environment_variables.EnvironmentVariablesBackend.get_variable")
- def test_get_variable_env_var(self, mock_env_get, mock_supervisor_comms,
patched_secrets_masker):
+ def test_get_variable_env_var(self, mock_env_get, mock_supervisor_comms):
"""Tests getting a variable from environment variable."""
mock_env_get.return_value = "fake_value"
Variable.get(key="fake_var_key")
@@ -172,9 +170,7 @@ class TestVariableFromSecrets:
"airflow.secrets.local_filesystem.LocalFilesystemBackend.get_variable",
)
@mock.patch("airflow.secrets.environment_variables.EnvironmentVariablesBackend.get_variable")
- def test_backend_fallback_to_env_var(
- self, mock_get_variable, mock_env_get, mock_supervisor_comms,
patched_secrets_masker
- ):
+ def test_backend_fallback_to_env_var(self, mock_get_variable,
mock_env_get, mock_supervisor_comms):
"""Tests if variable retrieval falls back to environment variable
backend if not found in secrets backend."""
mock_get_variable.return_value = None
mock_env_get.return_value = "fake_value"
diff --git a/task-sdk/tests/task_sdk/execution_time/test_supervisor.py
b/task-sdk/tests/task_sdk/execution_time/test_supervisor.py
index 1c04adafcc3..2277e74b8d2 100644
--- a/task-sdk/tests/task_sdk/execution_time/test_supervisor.py
+++ b/task-sdk/tests/task_sdk/execution_time/test_supervisor.py
@@ -181,7 +181,6 @@ class TestSupervisor:
)
def test_supervise(
self,
- patched_secrets_masker,
server,
dry_run,
expectation,