This is an automated email from the ASF dual-hosted git repository.
eladkal 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 b1cdb0c0079 Enable PT006 rule to google Provider test (operators
part1) (#57943)
b1cdb0c0079 is described below
commit b1cdb0c0079235707f8288509cd7e0f42ea034ed
Author: GUAN-HAO HUANG <[email protected]>
AuthorDate: Fri Nov 7 01:14:16 2025 +0800
Enable PT006 rule to google Provider test (operators part1) (#57943)
* modify test_variables
Co-authored-by: Kalyan R <[email protected]>
Signed-off-by: rich7420 <[email protected]>
* fix ci test
---------
Signed-off-by: rich7420 <[email protected]>
Co-authored-by: Kalyan R <[email protected]>
---
.../tests/unit/google/cloud/operators/test_bigquery.py | 14 +++++++-------
.../tests/unit/google/cloud/operators/test_bigtable.py | 12 ++++++------
.../tests/unit/google/cloud/operators/test_cloud_build.py | 8 ++++----
.../unit/google/cloud/operators/test_cloud_logging_sink.py | 12 ++++++------
.../tests/unit/google/cloud/operators/test_cloud_sql.py | 13 +++++++++++--
.../cloud/operators/test_cloud_storage_transfer_service.py | 6 +++---
6 files changed, 37 insertions(+), 28 deletions(-)
diff --git
a/providers/google/tests/unit/google/cloud/operators/test_bigquery.py
b/providers/google/tests/unit/google/cloud/operators/test_bigquery.py
index ba1ac6f6fab..5f2f2d02b8a 100644
--- a/providers/google/tests/unit/google/cloud/operators/test_bigquery.py
+++ b/providers/google/tests/unit/google/cloud/operators/test_bigquery.py
@@ -238,7 +238,7 @@ class TestBigQueryCreateTableOperator:
)
@pytest.mark.parametrize(
- "if_exists, is_conflict, expected_error, log_msg",
+ ("if_exists", "is_conflict", "expected_error", "log_msg"),
[
("ignore", False, None, None),
("log", False, None, None),
@@ -370,7 +370,7 @@ class TestBigQueryCreateEmptyDatasetOperator:
)
@pytest.mark.parametrize(
- "if_exists, is_conflict, expected_error, log_msg",
+ ("if_exists", "is_conflict", "expected_error", "log_msg"),
[
("ignore", False, None, None),
("log", False, None, None),
@@ -896,7 +896,7 @@ class TestBigQueryGetDatasetTablesOperator:
@pytest.mark.parametrize(
- "operator_class, kwargs",
+ ("operator_class", "kwargs"),
[
(BigQueryCheckOperator, dict(sql="Select * from test_table")),
(BigQueryValueCheckOperator, dict(sql="Select * from test_table",
pass_value=95)),
@@ -2480,7 +2480,7 @@ class TestBigQueryValueCheckOperator:
assert str(exc.value) == f"BigQuery job {real_job_id} failed: True"
@pytest.mark.parametrize(
- "kwargs, expected",
+ ("kwargs", "expected"),
[
({"sql": "SELECT COUNT(*) from Any"}, "missing keyword argument
'pass_value'"),
({"pass_value": "Any"}, "missing keyword argument 'sql'"),
@@ -2591,7 +2591,7 @@ class TestBigQueryValueCheckOperator:
@pytest.mark.db_test
class TestBigQueryColumnCheckOperator:
@pytest.mark.parametrize(
- "check_type, check_value, check_result",
+ ("check_type", "check_value", "check_result"),
[
("equal_to", 0, 0),
("greater_than", 0, 1),
@@ -2625,7 +2625,7 @@ class TestBigQueryColumnCheckOperator:
ti.task.execute(MagicMock())
@pytest.mark.parametrize(
- "check_type, check_value, check_result",
+ ("check_type", "check_value", "check_result"),
[
("equal_to", 0, 1),
("greater_than", 0, -1),
@@ -2658,7 +2658,7 @@ class TestBigQueryColumnCheckOperator:
ti.task.execute(MagicMock())
@pytest.mark.parametrize(
- "check_type, check_value, check_result",
+ ("check_type", "check_value", "check_result"),
[
("equal_to", 0, 0),
("greater_than", 0, 1),
diff --git
a/providers/google/tests/unit/google/cloud/operators/test_bigtable.py
b/providers/google/tests/unit/google/cloud/operators/test_bigtable.py
index 7bb54da1f60..53864b0b7c7 100644
--- a/providers/google/tests/unit/google/cloud/operators/test_bigtable.py
+++ b/providers/google/tests/unit/google/cloud/operators/test_bigtable.py
@@ -57,7 +57,7 @@ EMPTY_COLUMN_FAMILIES: dict = {}
class TestBigtableInstanceCreate:
@pytest.mark.parametrize(
- "missing_attribute, project_id, instance_id, main_cluster_id,
main_cluster_zone",
+ ("missing_attribute", "project_id", "instance_id", "main_cluster_id",
"main_cluster_zone"),
[
("instance_id", PROJECT_ID, "", CLUSTER_ID, CLUSTER_ZONE),
("main_cluster_id", PROJECT_ID, INSTANCE_ID, "", CLUSTER_ZONE),
@@ -283,7 +283,7 @@ class TestBigtableInstanceUpdate:
)
@pytest.mark.parametrize(
- "missing_attribute, project_id, instance_id",
+ ("missing_attribute", "project_id", "instance_id"),
[("instance_id", PROJECT_ID, "")],
)
@mock.patch("airflow.providers.google.cloud.operators.bigtable.BigtableHook")
@@ -385,7 +385,7 @@ class TestBigtableInstanceUpdate:
class TestBigtableClusterUpdate:
@pytest.mark.parametrize(
- "missing_attribute, project_id, instance_id, cluster_id, nodes",
+ ("missing_attribute", "project_id", "instance_id", "cluster_id",
"nodes"),
[
("instance_id", PROJECT_ID, "", CLUSTER_ID, NODES),
("cluster_id", PROJECT_ID, INSTANCE_ID, "", NODES),
@@ -572,7 +572,7 @@ class TestBigtableInstanceDelete:
)
@pytest.mark.parametrize(
- "missing_attribute, project_id, instance_id",
+ ("missing_attribute", "project_id", "instance_id"),
[("instance_id", PROJECT_ID, "")],
)
@mock.patch("airflow.providers.google.cloud.operators.bigtable.BigtableHook")
@@ -670,7 +670,7 @@ class TestBigtableTableDelete:
)
@pytest.mark.parametrize(
- "missing_attribute, project_id, instance_id, table_id",
+ ("missing_attribute", "project_id", "instance_id", "table_id"),
[
("instance_id", PROJECT_ID, "", TABLE_ID),
("table_id", PROJECT_ID, INSTANCE_ID, ""),
@@ -810,7 +810,7 @@ class TestBigtableTableCreate:
)
@pytest.mark.parametrize(
- "missing_attribute, project_id, instance_id, table_id",
+ ("missing_attribute", "project_id", "instance_id", "table_id"),
[
("instance_id", PROJECT_ID, "", TABLE_ID),
("table_id", PROJECT_ID, INSTANCE_ID, ""),
diff --git
a/providers/google/tests/unit/google/cloud/operators/test_cloud_build.py
b/providers/google/tests/unit/google/cloud/operators/test_cloud_build.py
index 66602204431..782832a87f5 100644
--- a/providers/google/tests/unit/google/cloud/operators/test_cloud_build.py
+++ b/providers/google/tests/unit/google/cloud/operators/test_cloud_build.py
@@ -138,7 +138,7 @@ class TestCloudBuildOperator:
CloudBuildCreateBuildOperator(task_id="id")
@pytest.mark.parametrize(
- "file_type, file_content",
+ ("file_type", "file_content"),
[
(
".json",
@@ -333,7 +333,7 @@ class TestBuildProcessor:
BuildProcessor(build={"source": {}}).process_body()
@pytest.mark.parametrize(
- "url, expected_dict",
+ ("url", "expected_dict"),
[
(
"https://source.cloud.google.com/airflow-project/airflow-repo",
@@ -372,7 +372,7 @@ class TestBuildProcessor:
BuildProcessor(build=body).process_body()
@pytest.mark.parametrize(
- "url, expected_dict",
+ ("url", "expected_dict"),
[
(
"gs://bucket-name/airflow-object.tar.gz",
@@ -502,7 +502,7 @@ def
test_async_create_build_with_missing_build_should_throw_exception(mock_hook)
@pytest.mark.parametrize(
- "file_type, file_content",
+ ("file_type", "file_content"),
[
(
".json",
diff --git
a/providers/google/tests/unit/google/cloud/operators/test_cloud_logging_sink.py
b/providers/google/tests/unit/google/cloud/operators/test_cloud_logging_sink.py
index af2bf385341..d12cd82f599 100644
---
a/providers/google/tests/unit/google/cloud/operators/test_cloud_logging_sink.py
+++
b/providers/google/tests/unit/google/cloud/operators/test_cloud_logging_sink.py
@@ -512,7 +512,7 @@ class TestCloudLoggingListSinksOperator:
class TestCloudLoggingUpdateSinksOperator:
- @pytest.mark.parametrize("sink_config, update_mask", update_test_cases,
ids=update_test_ids)
+ @pytest.mark.parametrize(("sink_config", "update_mask"),
update_test_cases, ids=update_test_ids)
def test_template_fields(self, sink_config, update_mask):
operator = CloudLoggingUpdateSinkOperator(
task_id=TASK_ID,
@@ -536,7 +536,7 @@ class TestCloudLoggingUpdateSinksOperator:
assert "Required parameters are missing" in str(excinfo.value)
@mock.patch(CLOUD_LOGGING_HOOK_PATH)
- @pytest.mark.parametrize("sink_config, update_mask", update_test_cases,
ids=update_test_ids)
+ @pytest.mark.parametrize(("sink_config", "update_mask"),
update_test_cases, ids=update_test_ids)
def test_update_sink_success(self, hook_mock, sink_config, update_mask):
hook_instance = hook_mock.return_value
@@ -559,7 +559,7 @@ class TestCloudLoggingUpdateSinksOperator:
assert result == LogSink.to_dict(sink_)
@mock.patch(CLOUD_LOGGING_HOOK_PATH)
- @pytest.mark.parametrize("sink_config, update_mask", update_test_cases,
ids=update_test_ids)
+ @pytest.mark.parametrize(("sink_config", "update_mask"),
update_test_cases, ids=update_test_ids)
def test_update_sink_raises_not_found(self, hook_mock, sink_config,
update_mask):
hook_instance = hook_mock.return_value
@@ -580,7 +580,7 @@ class TestCloudLoggingUpdateSinksOperator:
hook_instance.update_sink.assert_not_called()
@mock.patch(CLOUD_LOGGING_HOOK_PATH)
- @pytest.mark.parametrize("sink_config, update_mask", update_test_cases,
ids=update_test_ids)
+ @pytest.mark.parametrize(("sink_config", "update_mask"),
update_test_cases, ids=update_test_ids)
def test_update_sink_raises_generic_error(self, hook_mock, sink_config,
update_mask):
hook_instance = hook_mock.return_value
hook_instance.get_sink.side_effect = GoogleAPICallError("something
went wrong")
@@ -664,7 +664,7 @@ class TestCloudLoggingUpdateSinksOperator:
operator.execute(context)
@mock.patch(CLOUD_LOGGING_HOOK_PATH)
- @pytest.mark.parametrize("sink_config, update_mask", update_test_cases,
ids=update_test_ids)
+ @pytest.mark.parametrize(("sink_config", "update_mask"),
update_test_cases, ids=update_test_ids)
def test_template_rendering(self, hook_mock, sink_config, update_mask):
with DAG(
dag_id="test_render_native",
@@ -718,7 +718,7 @@ class TestCloudLoggingUpdateSinksOperator:
)
@mock.patch(CLOUD_LOGGING_HOOK_PATH)
- @pytest.mark.parametrize("sink_config, update_mask", update_test_cases,
ids=update_test_ids)
+ @pytest.mark.parametrize(("sink_config", "update_mask"),
update_test_cases, ids=update_test_ids)
def test_template_rendering_with_proto(self, hook_mock, sink_config,
update_mask):
sink_obj = LogSink(**sink_config)
mask_obj = FieldMask(paths=update_mask["paths"])
diff --git
a/providers/google/tests/unit/google/cloud/operators/test_cloud_sql.py
b/providers/google/tests/unit/google/cloud/operators/test_cloud_sql.py
index e3a27f05d20..411d60d8a5b 100644
--- a/providers/google/tests/unit/google/cloud/operators/test_cloud_sql.py
+++ b/providers/google/tests/unit/google/cloud/operators/test_cloud_sql.py
@@ -745,7 +745,16 @@ class TestCloudSqlQueryValidation:
get_connection.side_effect = [gcp_connection, cloudsql_connection,
cloudsql_connection2]
@pytest.mark.parametrize(
- "project_id, location, instance_name, database_type, use_proxy,
use_ssl, sql, message",
+ (
+ "project_id",
+ "location",
+ "instance_name",
+ "database_type",
+ "use_proxy",
+ "use_ssl",
+ "sql",
+ "message",
+ ),
[
(
"project_id",
@@ -841,7 +850,7 @@ class TestCloudSqlQueryValidation:
assert "The UNIX socket path length cannot exceed" in str(err)
@pytest.mark.parametrize(
- "connection_port, default_port, expected_port",
+ ("connection_port", "default_port", "expected_port"),
[(None, 4321, 4321), (1234, None, 1234), (1234, 4321, 1234)],
)
def test_execute_openlineage_events(self, connection_port, default_port,
expected_port):
diff --git
a/providers/google/tests/unit/google/cloud/operators/test_cloud_storage_transfer_service.py
b/providers/google/tests/unit/google/cloud/operators/test_cloud_storage_transfer_service.py
index 60257593333..5a1c34409f7 100644
---
a/providers/google/tests/unit/google/cloud/operators/test_cloud_storage_transfer_service.py
+++
b/providers/google/tests/unit/google/cloud/operators/test_cloud_storage_transfer_service.py
@@ -387,7 +387,7 @@ class TestGcpStorageTransferJobCreateOperator:
# fields
@pytest.mark.db_test
@pytest.mark.parametrize(
- "body, excepted",
+ ("body", "excepted"),
[(VALID_TRANSFER_JOB_JINJA, VALID_TRANSFER_JOB_JINJA_RENDERED)],
)
@mock.patch(
@@ -1024,7 +1024,7 @@ class TestS3ToGoogleCloudStorageTransferOperator:
)
@pytest.mark.parametrize(
- "wait, job_name",
+ ("wait", "job_name"),
[
(True, "transferJobs/123"),
(False, "transferJobs/456"),
@@ -1079,7 +1079,7 @@ class TestS3ToGoogleCloudStorageTransferOperator:
assert run_facet.wait == wait
@pytest.mark.parametrize(
- "object_conditions, delete_source",
+ ("object_conditions", "delete_source"),
[
({"includePrefixes": ["2025/"]}, True),
(None, False),