This is an automated email from the ASF dual-hosted git repository.

shahar 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 36b4545500a Enable PT006 rule to airflow-core tests (models) (#57949)
36b4545500a is described below

commit 36b4545500aa46af86a4932f065b59c46148cd7a
Author: Chao-Hung Wan <[email protected]>
AuthorDate: Sat Nov 8 02:45:04 2025 +0800

    Enable PT006 rule to airflow-core tests (models) (#57949)
    
    * modify test_asset
    
    Co-authored-by: Kalyan R <[email protected]>
    Signed-off-by: Xch1 <[email protected]>
    
    * modify test_backfill
    
    Co-authored-by: Kalyan R <[email protected]>
    Signed-off-by: Xch1 <[email protected]>
    
    * modify test_callback
    
    Co-authored-by: Kalyan R <[email protected]>
    Signed-off-by: Xch1 <[email protected]>
    
    * modify test_cleartasks
    
    Co-authored-by: Kalyan R <[email protected]>
    Signed-off-by: Xch1 <[email protected]>
    
    * modify test_connection
    
    Co-authored-by: Kalyan R <[email protected]>
    Signed-off-by: Xch1 <[email protected]>
    
    * modify test_dag
    
    Co-authored-by: Kalyan R <[email protected]>
    Signed-off-by: Xch1 <[email protected]>
    
    * modify test_dagrun
    
    Co-authored-by: Kalyan R <[email protected]>
    Signed-off-by: Xch1 <[email protected]>
    
    * modify test_deadline
    
    Co-authored-by: Kalyan R <[email protected]>
    Signed-off-by: Xch1 <[email protected]>
    
    ---------
    
    Signed-off-by: Xch1 <[email protected]>
    Co-authored-by: Kalyan R <[email protected]>
---
 airflow-core/tests/unit/models/test_asset.py      |  2 +-
 airflow-core/tests/unit/models/test_backfill.py   |  2 +-
 airflow-core/tests/unit/models/test_callback.py   |  4 ++--
 airflow-core/tests/unit/models/test_cleartasks.py |  6 +++---
 airflow-core/tests/unit/models/test_connection.py | 19 +++++++++++++-----
 airflow-core/tests/unit/models/test_dag.py        | 24 +++++++++++------------
 airflow-core/tests/unit/models/test_dagrun.py     | 16 +++++++--------
 airflow-core/tests/unit/models/test_deadline.py   |  6 +++---
 8 files changed, 44 insertions(+), 35 deletions(-)

diff --git a/airflow-core/tests/unit/models/test_asset.py 
b/airflow-core/tests/unit/models/test_asset.py
index 13e0754faad..cb84ea6792e 100644
--- a/airflow-core/tests/unit/models/test_asset.py
+++ b/airflow-core/tests/unit/models/test_asset.py
@@ -94,7 +94,7 @@ class TestAssetAliasModel:
 
 
 @pytest.mark.parametrize(
-    "select_stmt, expected_before_clear_1, expected_before_clear_2",
+    ("select_stmt", "expected_before_clear_1", "expected_before_clear_2"),
     [
         pytest.param(
             select(AssetModel.name, AssetModel.uri, 
DagScheduleAssetReference.dag_id),
diff --git a/airflow-core/tests/unit/models/test_backfill.py 
b/airflow-core/tests/unit/models/test_backfill.py
index 79feb52e6b7..060f1c74790 100644
--- a/airflow-core/tests/unit/models/test_backfill.py
+++ b/airflow-core/tests/unit/models/test_backfill.py
@@ -222,7 +222,7 @@ def 
test_create_backfill_clear_existing_bundle_version(dag_maker, session, run_o
 
 
 @pytest.mark.parametrize(
-    "reprocess_behavior, num_in_b, exc_reasons",
+    ("reprocess_behavior", "num_in_b", "exc_reasons"),
     [
         (
             ReprocessBehavior.NONE,
diff --git a/airflow-core/tests/unit/models/test_callback.py 
b/airflow-core/tests/unit/models/test_callback.py
index a9173dbb0c5..36e09713a3d 100644
--- a/airflow-core/tests/unit/models/test_callback.py
+++ b/airflow-core/tests/unit/models/test_callback.py
@@ -67,7 +67,7 @@ def clean_db(request):
 
 class TestCallback:
     @pytest.mark.parametrize(
-        "callback_def, expected_cb_instance",
+        ("callback_def", "expected_cb_instance"),
         [
             pytest.param(
                 TEST_ASYNC_CALLBACK, 
TriggererCallback(callback_def=TEST_ASYNC_CALLBACK), id="triggerer"
@@ -140,7 +140,7 @@ class TestTriggererCallback:
         assert callback.state == CallbackState.QUEUED
 
     @pytest.mark.parametrize(
-        "event, terminal_state",
+        ("event", "terminal_state"),
         [
             pytest.param(
                 TriggerEvent({PAYLOAD_STATUS_KEY: CallbackState.SUCCESS, 
PAYLOAD_BODY_KEY: "test_result"}),
diff --git a/airflow-core/tests/unit/models/test_cleartasks.py 
b/airflow-core/tests/unit/models/test_cleartasks.py
index 9a1f37c89ca..ca2fa19a03e 100644
--- a/airflow-core/tests/unit/models/test_cleartasks.py
+++ b/airflow-core/tests/unit/models/test_cleartasks.py
@@ -153,7 +153,7 @@ class TestClearTasks:
         assert ti0.next_kwargs is None
 
     @pytest.mark.parametrize(
-        ["state", "last_scheduling"], [(DagRunState.QUEUED, None), 
(DagRunState.RUNNING, DEFAULT_DATE)]
+        ("state", "last_scheduling"), [(DagRunState.QUEUED, None), 
(DagRunState.RUNNING, DEFAULT_DATE)]
     )
     def test_clear_task_instances_dr_state(self, state, last_scheduling, 
dag_maker):
         """
@@ -243,7 +243,7 @@ class TestClearTasks:
         assert dr.last_scheduling_decision == DEFAULT_DATE
 
     @pytest.mark.parametrize(
-        ["state", "last_scheduling"],
+        ("state", "last_scheduling"),
         [
             (DagRunState.SUCCESS, None),
             (DagRunState.SUCCESS, DEFAULT_DATE),
@@ -491,7 +491,7 @@ class TestClearTasks:
             assert count_task_reschedule(ti1) == 1
 
     @pytest.mark.parametrize(
-        ["state", "state_recorded"],
+        ("state", "state_recorded"),
         [
             (TaskInstanceState.SUCCESS, TaskInstanceState.SUCCESS),
             (TaskInstanceState.FAILED, TaskInstanceState.FAILED),
diff --git a/airflow-core/tests/unit/models/test_connection.py 
b/airflow-core/tests/unit/models/test_connection.py
index 93779a1bc5e..947c5469e37 100644
--- a/airflow-core/tests/unit/models/test_connection.py
+++ b/airflow-core/tests/unit/models/test_connection.py
@@ -48,8 +48,17 @@ class TestConnection:
         get_fernet.cache_clear()
 
     @pytest.mark.parametrize(
-        "uri, expected_conn_type, expected_host, expected_login, 
expected_password,"
-        " expected_port, expected_schema, expected_extra_dict, 
expected_exception_message",
+        (
+            "uri",
+            "expected_conn_type",
+            "expected_host",
+            "expected_login",
+            "expected_password",
+            "expected_port",
+            "expected_schema",
+            "expected_extra_dict",
+            "expected_exception_message",
+        ),
         [
             (
                 "type://user:pass@host:100/schema",
@@ -167,7 +176,7 @@ class TestConnection:
             assert conn.extra_dejson == expected_extra_dict
 
     @pytest.mark.parametrize(
-        "connection, expected_uri",
+        ("connection", "expected_uri"),
         [
             (
                 Connection(
@@ -209,7 +218,7 @@ class TestConnection:
         assert connection.get_uri() == expected_uri
 
     @pytest.mark.parametrize(
-        "connection, expected_conn_id",
+        ("connection", "expected_conn_id"),
         [
             # a valid example of connection id
             (
@@ -273,7 +282,7 @@ class TestConnection:
         assert connection.conn_id == expected_conn_id
 
     @pytest.mark.parametrize(
-        "conn_type, host",
+        ("conn_type", "host"),
         [
             # same protocol to type
             ("http", "http://host";),
diff --git a/airflow-core/tests/unit/models/test_dag.py 
b/airflow-core/tests/unit/models/test_dag.py
index 4ce4d00054d..963968dcfa2 100644
--- a/airflow-core/tests/unit/models/test_dag.py
+++ b/airflow-core/tests/unit/models/test_dag.py
@@ -240,7 +240,7 @@ class TestDag:
         assert dag.timezone == settings.TIMEZONE
 
     @pytest.mark.parametrize(
-        "cls, expected",
+        ("cls", "expected"),
         [
             (StaticTestPriorityWeightStrategy, 99),
             (FactorPriorityWeightStrategy, 3),
@@ -299,7 +299,7 @@ class TestDag:
         assert jinja_env.undefined is jinja2.Undefined
 
     @pytest.mark.parametrize(
-        "use_native_obj, force_sandboxed, expected_env",
+        ("use_native_obj", "force_sandboxed", "expected_env"),
         [
             (False, True, SandboxedEnvironment),
             (False, False, SandboxedEnvironment),
@@ -556,7 +556,7 @@ class TestDag:
                 mock_active_runs_of_dags.assert_not_called()
 
     @pytest.mark.parametrize(
-        "state,catchup,expected_next_dagrun",
+        ("state", "catchup", "expected_next_dagrun"),
         [
             # With catchup=True, next_dagrun is the start date
             (DagRunState.RUNNING, True, DEFAULT_DATE),
@@ -955,7 +955,7 @@ class TestDag:
             dag_run.handle_dag_callback(dag=dag, success=False)
             dag_run.handle_dag_callback(dag=dag, success=True)
 
-    @pytest.mark.parametrize("catchup,expected_next_dagrun", [(True, 
DEFAULT_DATE), (False, None)])
+    @pytest.mark.parametrize(("catchup", "expected_next_dagrun"), [(True, 
DEFAULT_DATE), (False, None)])
     def test_next_dagrun_after_fake_scheduled_previous(
         self, catchup, expected_next_dagrun, testing_dag_bundle
     ):
@@ -1118,7 +1118,7 @@ class TestDag:
             session.query(DagModel).filter(DagModel.dag_id == 
dag_id).delete(synchronize_session=False)
 
     @pytest.mark.parametrize(
-        "schedule_arg, expected_timetable, interval_description",
+        ("schedule_arg", "expected_timetable", "interval_description"),
         [
             (None, NullTimetable(), "Never, external triggers only"),
             ("@daily", cron_timetable("0 0 * * *"), "At 00:00"),
@@ -1148,7 +1148,7 @@ class TestDag:
         assert dag.timetable.description == "Triggered by assets"
 
     @pytest.mark.parametrize(
-        "timetable, expected_description",
+        ("timetable", "expected_description"),
         [
             (NullTimetable(), "Never, external triggers only"),
             (cron_timetable("0 0 * * *"), "At 00:00"),
@@ -1424,7 +1424,7 @@ my_postgres_conn:
         dag.test(conn_file_path=os.fspath(path))
 
     @pytest.mark.parametrize(
-        "ti_state_begin, ti_state_end",
+        ("ti_state_begin", "ti_state_end"),
         [
             *((state, None) for state in State.task_states if state != 
TaskInstanceState.RUNNING),
             (TaskInstanceState.RUNNING, TaskInstanceState.RESTARTING),
@@ -1820,7 +1820,7 @@ my_postgres_conn:
 
     @pytest.mark.need_serialized_dag
     @pytest.mark.parametrize(
-        "reference_type, reference_column",
+        ("reference_type", "reference_column"),
         [
             pytest.param(DeadlineReference.DAGRUN_LOGICAL_DATE, 
"logical_date", id="logical_date"),
             pytest.param(DeadlineReference.DAGRUN_QUEUED_AT, "queued_at", 
id="queued_at"),
@@ -2635,7 +2635,7 @@ def 
test_dag_teardowns_property_lists_all_teardown_tasks():
 
 
 @pytest.mark.parametrize(
-    "start_date, expected_infos",
+    ("start_date", "expected_infos"),
     [
         (
             DEFAULT_DATE,
@@ -2721,7 +2721,7 @@ def test_iter_dagrun_infos_between_error(caplog):
 
 
 @pytest.mark.parametrize(
-    "logical_date, data_interval_start, data_interval_end, 
expected_data_interval",
+    ("logical_date", "data_interval_start", "data_interval_end", 
"expected_data_interval"),
     [
         pytest.param(None, None, None, None, id="no-next-run"),
         pytest.param(
@@ -3238,7 +3238,7 @@ class TestTaskClearingSetupTeardownBehavior:
             assert self.cleared_neither(s1) == {s1, t1}
 
     @pytest.mark.parametrize(
-        "upstream, downstream, expected",
+        ("upstream", "downstream", "expected"),
         [
             (False, False, {"my_teardown", "my_setup"}),
             (False, True, {"my_setup", "my_work", "my_teardown"}),
@@ -3414,7 +3414,7 @@ class TestTaskClearingSetupTeardownBehavior:
 
 
 @pytest.mark.parametrize(
-    "disable, bundle_version, expected",
+    ("disable", "bundle_version", "expected"),
     [
         (True, "some-version", None),
         (False, "some-version", "some-version"),
diff --git a/airflow-core/tests/unit/models/test_dagrun.py 
b/airflow-core/tests/unit/models/test_dagrun.py
index df3bd4e354a..0e2978124ea 100644
--- a/airflow-core/tests/unit/models/test_dagrun.py
+++ b/airflow-core/tests/unit/models/test_dagrun.py
@@ -911,7 +911,7 @@ class TestDagRun:
         assert task.queue == "queue1"
 
     @pytest.mark.parametrize(
-        "prev_ti_state, is_ti_schedulable",
+        ("prev_ti_state", "is_ti_schedulable"),
         [
             (TaskInstanceState.SUCCESS, True),
             (TaskInstanceState.SKIPPED, True),
@@ -953,7 +953,7 @@ class TestDagRun:
         assert ("test_dop_task" in schedulable_tis) == is_ti_schedulable
 
     @pytest.mark.parametrize(
-        "prev_ti_state, is_ti_schedulable",
+        ("prev_ti_state", "is_ti_schedulable"),
         [
             (TaskInstanceState.SUCCESS, True),
             (TaskInstanceState.SKIPPED, True),
@@ -1078,7 +1078,7 @@ class TestDagRun:
         assert call(f"dagrun.{dag.dag_id}.first_task_scheduling_delay") not in 
stats_mock.mock_calls
 
     @pytest.mark.parametrize(
-        "schedule, expected",
+        ("schedule", "expected"),
         [
             ("*/5 * * * *", True),
             (None, False),
@@ -2199,7 +2199,7 @@ def 
test_schedulable_task_exist_when_rerun_removed_upstream_mapped_task(session,
 
 
 @pytest.mark.parametrize(
-    "partial_params, mapped_params, expected",
+    ("partial_params", "mapped_params", "expected"),
     [
         pytest.param(None, [{"a": 1}], 1, id="simple"),
         pytest.param({"b": 2}, [{"a": 1}], 1, id="merge"),
@@ -2574,7 +2574,7 @@ def test_dagrun_with_note(dag_maker, session):
 
 
 @pytest.mark.parametrize(
-    "dag_run_state, on_failure_fail_dagrun", [[DagRunState.SUCCESS, False], 
[DagRunState.FAILED, True]]
+    ("dag_run_state", "on_failure_fail_dagrun"), [[DagRunState.SUCCESS, 
False], [DagRunState.FAILED, True]]
 )
 def test_teardown_failure_behaviour_on_dagrun(dag_maker, session, 
dag_run_state, on_failure_fail_dagrun):
     with dag_maker():
@@ -2604,7 +2604,7 @@ def test_teardown_failure_behaviour_on_dagrun(dag_maker, 
session, dag_run_state,
 
 
 @pytest.mark.parametrize(
-    "dag_run_state, on_failure_fail_dagrun", [[DagRunState.SUCCESS, False], 
[DagRunState.FAILED, True]]
+    ("dag_run_state", "on_failure_fail_dagrun"), [[DagRunState.SUCCESS, 
False], [DagRunState.FAILED, True]]
 )
 def test_teardown_failure_on_non_leaf_behaviour_on_dagrun(
     dag_maker, session, dag_run_state, on_failure_fail_dagrun
@@ -2714,7 +2714,7 @@ def 
test_failure_of_leaf_task_not_connected_to_teardown_task(dag_maker, session)
 
 
 @pytest.mark.parametrize(
-    "input, expected",
+    ("input", "expected"),
     [
         (["s1 >> w1 >> t1"], {"w1"}),  # t1 ignored
         (["s1 >> w1 >> t1", "s1 >> t1"], {"w1"}),  # t1 ignored; properly 
wired to setup
@@ -2779,7 +2779,7 @@ def test_tis_considered_for_state(dag_maker, session, 
input, expected):
 
 
 @pytest.mark.parametrize(
-    "pattern, run_id, result",
+    ("pattern", "run_id", "result"),
     [
         ["^[A-Z]", "ABC", True],
         ["^[A-Z]", "abc", False],
diff --git a/airflow-core/tests/unit/models/test_deadline.py 
b/airflow-core/tests/unit/models/test_deadline.py
index 9642a21f3cb..0f87555e9a0 100644
--- a/airflow-core/tests/unit/models/test_deadline.py
+++ b/airflow-core/tests/unit/models/test_deadline.py
@@ -184,7 +184,7 @@ class TestCalculatedDeadlineDatabaseCalls:
         _clean_db()
 
     @pytest.mark.parametrize(
-        "column, conditions, expected_query",
+        ("column", "conditions", "expected_query"),
         [
             pytest.param(
                 DagRun.logical_date,
@@ -227,7 +227,7 @@ class TestCalculatedDeadlineDatabaseCalls:
             assert compiled.params[f"{key}_1"] == value
 
     @pytest.mark.parametrize(
-        "use_valid_conditions, scalar_side_effect, expected_error, 
expected_message",
+        ("use_valid_conditions", "scalar_side_effect", "expected_error", 
"expected_message"),
         [
             pytest.param(
                 False,
@@ -263,7 +263,7 @@ class TestCalculatedDeadlineDatabaseCalls:
             _fetch_from_db(model_reference, session=mock_session, **conditions)
 
     @pytest.mark.parametrize(
-        "reference, expected_column",
+        ("reference", "expected_column"),
         [
             pytest.param(DeadlineReference.DAGRUN_LOGICAL_DATE, 
DagRun.logical_date, id="logical_date"),
             pytest.param(DeadlineReference.DAGRUN_QUEUED_AT, DagRun.queued_at, 
id="queued_at"),

Reply via email to