This is an automated email from the ASF dual-hosted git repository.
uranusjr 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 b1098a82376 Enable PT006 rule to 9 files in providers
(snowflake,smtp/tests) (#57845)
b1098a82376 is described below
commit b1098a82376683aa0b6b50e9e280c13519aeb935
Author: Anusha Kovi <[email protected]>
AuthorDate: Wed Nov 5 21:02:14 2025 -0500
Enable PT006 rule to 9 files in providers (snowflake,smtp/tests) (#57845)
Co-authored-by: Kalyan R <[email protected]>
---
providers/smtp/tests/unit/smtp/hooks/test_smtp.py | 8 ++++----
.../snowflake/tests/unit/snowflake/hooks/test_snowflake.py | 4 ++--
.../tests/unit/snowflake/hooks/test_snowflake_sql_api.py | 14 +++++++-------
providers/snowflake/tests/unit/snowflake/hooks/test_sql.py | 13 +++++++++++--
.../tests/unit/snowflake/operators/test_snowflake.py | 4 ++--
.../tests/unit/snowflake/operators/test_snowflake_sql.py | 2 +-
.../snowflake/tests/unit/snowflake/utils/test_common.py | 2 +-
.../snowflake/tests/unit/snowflake/utils/test_snowpark.py | 2 +-
.../unit/snowflake/utils/test_sql_api_generate_jwt.py | 2 +-
9 files changed, 30 insertions(+), 21 deletions(-)
diff --git a/providers/smtp/tests/unit/smtp/hooks/test_smtp.py
b/providers/smtp/tests/unit/smtp/hooks/test_smtp.py
index e3fad4d7ae3..0e92b263de7 100644
--- a/providers/smtp/tests/unit/smtp/hooks/test_smtp.py
+++ b/providers/smtp/tests/unit/smtp/hooks/test_smtp.py
@@ -129,7 +129,7 @@ class TestSmtpHook:
)
@pytest.mark.parametrize(
- "conn_id, use_ssl, expected_port, create_context",
+ ("conn_id", "use_ssl", "expected_port", "create_context"),
[
pytest.param(CONN_ID_DEFAULT, True, DEFAULT_PORT, True,
id="ssl-connection"),
pytest.param(CONN_ID_NONSSL, False, NONSSL_PORT, False,
id="non-ssl-connection"),
@@ -263,7 +263,7 @@ class TestSmtpHook:
assert smtp_client_mock.close.called
@pytest.mark.parametrize(
- "conn_id, ssl_context, create_context_called, use_default_context",
+ ("conn_id", "ssl_context", "create_context_called",
"use_default_context"),
[
pytest.param(CONN_ID_DEFAULT, "default", True, True,
id="default_context"),
pytest.param(CONN_ID_SSL_EXTRA, "none", False, False,
id="none_context"),
@@ -558,7 +558,7 @@ class TestSmtpHookAsync:
return mock_client
@pytest.mark.parametrize(
- "conn_id, expected_port, expected_ssl",
+ ("conn_id", "expected_port", "expected_ssl"),
[
pytest.param(CONN_ID_NONSSL, NONSSL_PORT, False,
id="non-ssl-connection"),
pytest.param(CONN_ID_DEFAULT, DEFAULT_PORT, True,
id="ssl-connection"),
@@ -604,7 +604,7 @@ class TestSmtpHookAsync:
assert f"Subject: {TEST_SUBJECT}" in call_args[2] # message is the
third positional arg
@pytest.mark.parametrize(
- "side_effect, expected_calls, should_raise",
+ ("side_effect", "expected_calls", "should_raise"),
[
pytest.param(
[SERVER_DISCONNECTED_ERROR, SERVER_DISCONNECTED_ERROR, None],
diff --git a/providers/snowflake/tests/unit/snowflake/hooks/test_snowflake.py
b/providers/snowflake/tests/unit/snowflake/hooks/test_snowflake.py
index c6577b67de8..163b8753801 100644
--- a/providers/snowflake/tests/unit/snowflake/hooks/test_snowflake.py
+++ b/providers/snowflake/tests/unit/snowflake/hooks/test_snowflake.py
@@ -106,7 +106,7 @@ def
base64_encoded_encrypted_private_key(encrypted_temporary_private_key: Path)
class TestPytestSnowflakeHook:
@pytest.mark.parametrize(
- "connection_kwargs,expected_uri,expected_conn_params",
+ ("connection_kwargs", "expected_uri", "expected_conn_params"),
[
(
BASE_CONNECTION_KWARGS,
@@ -857,7 +857,7 @@ class TestPytestSnowflakeHook:
)
@pytest.mark.parametrize(
- "sql,expected_sql,expected_query_ids",
+ ("sql", "expected_sql", "expected_query_ids"),
[
("select * from table", ["select * from table"], ["uuid"]),
(
diff --git
a/providers/snowflake/tests/unit/snowflake/hooks/test_snowflake_sql_api.py
b/providers/snowflake/tests/unit/snowflake/hooks/test_snowflake_sql_api.py
index 56c30afa374..efb2c587460 100644
--- a/providers/snowflake/tests/unit/snowflake/hooks/test_snowflake_sql_api.py
+++ b/providers/snowflake/tests/unit/snowflake/hooks/test_snowflake_sql_api.py
@@ -218,7 +218,7 @@ def
create_async_request_client_response_success(json=GET_RESPONSE, status_code=
class TestSnowflakeSqlApiHook:
@pytest.mark.parametrize(
- "sql,statement_count,expected_response, expected_query_ids",
+ ("sql", "statement_count", "expected_response", "expected_query_ids"),
[
(SINGLE_STMT, 1, {"statementHandle": "uuid"}, ["uuid"]),
(SQL_MULTIPLE_STMTS, 4, {"statementHandles": ["uuid", "uuid1"]},
["uuid", "uuid1"]),
@@ -285,7 +285,7 @@ class TestSnowflakeSqlApiHook:
assert query_ids == expected_query_ids
@pytest.mark.parametrize(
- "sql,statement_count,expected_response, expected_query_ids",
+ ("sql", "statement_count", "expected_response", "expected_query_ids"),
[(SINGLE_STMT, 1, {"statementHandle": "uuid"}, ["uuid"])],
)
@mock.patch(f"{HOOK_PATH}._get_conn_params", new_callable=PropertyMock)
@@ -313,7 +313,7 @@ class TestSnowflakeSqlApiHook:
assert exception_info
@pytest.mark.parametrize(
- "sql,statement_count,bindings",
+ ("sql", "statement_count", "bindings"),
[
(SQL_MULTIPLE_STMTS, 4, {"1": {"type": "FIXED", "value": "123"}}),
],
@@ -589,7 +589,7 @@ class TestSnowflakeSqlApiHook:
SnowflakeSqlApiHook(snowflake_conn_id="test_conn").get_private_key()
@pytest.mark.parametrize(
- "status_code,response,expected_response",
+ ("status_code", "response", "expected_response"),
[
(
200,
@@ -662,7 +662,7 @@ class TestSnowflakeSqlApiHook:
@pytest.mark.asyncio
@pytest.mark.parametrize(
- "status_code,response,expected_response",
+ ("status_code", "response", "expected_response"),
[
(
200,
@@ -722,7 +722,7 @@ class TestSnowflakeSqlApiHook:
assert hook.role == hook_params.get("role", None)
@pytest.mark.parametrize(
- "test_hook_params, sql, statement_count, expected_payload,
expected_response",
+ ("test_hook_params", "sql", "statement_count", "expected_payload",
"expected_response"),
[
(
{},
@@ -842,7 +842,7 @@ class TestSnowflakeSqlApiHook:
)
@pytest.mark.parametrize(
- "status_code,should_retry",
+ ("status_code", "should_retry"),
[
(429, True), # Too Many Requests - should retry
(503, True), # Service Unavailable - should retry
diff --git a/providers/snowflake/tests/unit/snowflake/hooks/test_sql.py
b/providers/snowflake/tests/unit/snowflake/hooks/test_sql.py
index ae11cd9fbd6..0c54fd2c426 100644
--- a/providers/snowflake/tests/unit/snowflake/hooks/test_sql.py
+++ b/providers/snowflake/tests/unit/snowflake/hooks/test_sql.py
@@ -42,8 +42,17 @@ def get_cursor_descriptions(fields: list[str]) ->
list[tuple[str]]:
@pytest.mark.parametrize(
- "return_last, split_statements, sql, cursor_calls,"
- "cursor_descriptions, cursor_results, hook_descriptions, hook_results,
return_dictionaries",
+ (
+ "return_last",
+ "split_statements",
+ "sql",
+ "cursor_calls",
+ "cursor_descriptions",
+ "cursor_results",
+ "hook_descriptions",
+ "hook_results",
+ "return_dictionaries",
+ ),
[
pytest.param(
True,
diff --git
a/providers/snowflake/tests/unit/snowflake/operators/test_snowflake.py
b/providers/snowflake/tests/unit/snowflake/operators/test_snowflake.py
index 2862214394c..15e763234e8 100644
--- a/providers/snowflake/tests/unit/snowflake/operators/test_snowflake.py
+++ b/providers/snowflake/tests/unit/snowflake/operators/test_snowflake.py
@@ -187,7 +187,7 @@ class TestSnowflakeIntervalCheckOperator:
@pytest.mark.parametrize(
- "operator_class, kwargs",
+ ("operator_class", "kwargs"),
[
(SnowflakeCheckOperator, dict(sql="Select * from test_table")),
(SnowflakeValueCheckOperator, dict(sql="Select * from test_table",
pass_value=95)),
@@ -342,7 +342,7 @@ class TestSnowflakeSqlApiOperator:
operator.execute(context=None)
@pytest.mark.parametrize(
- "mock_sql, statement_count",
+ ("mock_sql", "statement_count"),
[pytest.param(SQL_MULTIPLE_STMTS, 4, id="multi"),
pytest.param(SINGLE_STMT, 1, id="single")],
)
@mock.patch("airflow.providers.snowflake.hooks.snowflake_sql_api.SnowflakeSqlApiHook.execute_query")
diff --git
a/providers/snowflake/tests/unit/snowflake/operators/test_snowflake_sql.py
b/providers/snowflake/tests/unit/snowflake/operators/test_snowflake_sql.py
index 1c47a022c51..c8c50f92038 100644
--- a/providers/snowflake/tests/unit/snowflake/operators/test_snowflake_sql.py
+++ b/providers/snowflake/tests/unit/snowflake/operators/test_snowflake_sql.py
@@ -55,7 +55,7 @@ DEFAULT_CONN_ID = "snowflake_default"
@pytest.mark.parametrize(
- "sql, return_last, split_statement, hook_results, hook_descriptions,
expected_results",
+ ("sql", "return_last", "split_statement", "hook_results",
"hook_descriptions", "expected_results"),
[
pytest.param(
"select * from dummy",
diff --git a/providers/snowflake/tests/unit/snowflake/utils/test_common.py
b/providers/snowflake/tests/unit/snowflake/utils/test_common.py
index 7ded5b9ea01..ee2d15845e4 100644
--- a/providers/snowflake/tests/unit/snowflake/utils/test_common.py
+++ b/providers/snowflake/tests/unit/snowflake/utils/test_common.py
@@ -22,7 +22,7 @@ from airflow.providers.snowflake.utils.common import
enclose_param
@pytest.mark.parametrize(
- "param,expected",
+ ("param", "expected"),
[
("without quotes", "'without quotes'"),
("'with quotes'", "'''with quotes'''"),
diff --git a/providers/snowflake/tests/unit/snowflake/utils/test_snowpark.py
b/providers/snowflake/tests/unit/snowflake/utils/test_snowpark.py
index 57d37a86fbc..181d8ed8f3a 100644
--- a/providers/snowflake/tests/unit/snowflake/utils/test_snowpark.py
+++ b/providers/snowflake/tests/unit/snowflake/utils/test_snowpark.py
@@ -24,7 +24,7 @@ from airflow.providers.snowflake.utils.snowpark import
inject_session_into_op_kw
@pytest.mark.parametrize(
- "func,expected_injected",
+ ("func", "expected_injected"),
[
(lambda x: x, False),
(lambda: 1, False),
diff --git
a/providers/snowflake/tests/unit/snowflake/utils/test_sql_api_generate_jwt.py
b/providers/snowflake/tests/unit/snowflake/utils/test_sql_api_generate_jwt.py
index 71519714299..392bb26ac0b 100644
---
a/providers/snowflake/tests/unit/snowflake/utils/test_sql_api_generate_jwt.py
+++
b/providers/snowflake/tests/unit/snowflake/utils/test_sql_api_generate_jwt.py
@@ -36,7 +36,7 @@ private_key = key.private_bytes(
class TestJWTGenerator:
@pytest.mark.parametrize(
- "account_name, expected_account_name",
+ ("account_name", "expected_account_name"),
[("test.us-east-1", "TEST"), ("test.global", "TEST.GLOBAL"), ("test",
"TEST")],
)
def test_prepare_account_name_for_jwt(self, account_name,
expected_account_name):