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 2b7704356e9 Enable PT006 rule to airflow-core tests (security, 
lineage, jobs, executors, datasets) (#57913)
2b7704356e9 is described below

commit 2b7704356e9e821160c5ce9cece9988e12cbe5bb
Author: Xch1 <[email protected]>
AuthorDate: Thu Nov 6 11:42:08 2025 +0800

    Enable PT006 rule to airflow-core tests (security, lineage, jobs, 
executors, datasets) (#57913)
    
    Co-authored-by: Kalyan R <[email protected]>
---
 airflow-core/tests/unit/datasets/test_dataset.py   |  2 +-
 .../tests/unit/executors/test_base_executor.py     |  4 +--
 .../tests/unit/executors/test_local_executor.py    |  2 +-
 airflow-core/tests/unit/jobs/test_base_job.py      |  4 +--
 airflow-core/tests/unit/jobs/test_scheduler_job.py | 42 +++++++++++-----------
 airflow-core/tests/unit/jobs/test_triggerer_job.py |  2 +-
 airflow-core/tests/unit/lineage/test_hook.py       |  2 +-
 airflow-core/tests/unit/security/test_kerberos.py  |  2 +-
 8 files changed, 30 insertions(+), 30 deletions(-)

diff --git a/airflow-core/tests/unit/datasets/test_dataset.py 
b/airflow-core/tests/unit/datasets/test_dataset.py
index b24928d5105..7182e94839e 100644
--- a/airflow-core/tests/unit/datasets/test_dataset.py
+++ b/airflow-core/tests/unit/datasets/test_dataset.py
@@ -22,7 +22,7 @@ import pytest
 
 
 @pytest.mark.parametrize(
-    "module_path, attr_name, expected_value, warning_message",
+    ("module_path", "attr_name", "expected_value", "warning_message"),
     (
         pytest.param(
             "airflow",
diff --git a/airflow-core/tests/unit/executors/test_base_executor.py 
b/airflow-core/tests/unit/executors/test_base_executor.py
index 63bc4731cc9..13ab21d3a41 100644
--- a/airflow-core/tests/unit/executors/test_base_executor.py
+++ b/airflow-core/tests/unit/executors/test_base_executor.py
@@ -125,7 +125,7 @@ def 
test_gauge_executor_metrics_single_executor(mock_stats_gauge, mock_trigger_t
 
 
 @pytest.mark.parametrize(
-    "executor_class, executor_name",
+    ("executor_class", "executor_name"),
     [(LocalExecutor, "LocalExecutor")],
 )
 @mock.patch("airflow.executors.local_executor.LocalExecutor.sync")
@@ -285,7 +285,7 @@ def test_parser_add_command(mock_add_command, 
mock_get_cli_command):
     mock_add_command.assert_called_once()
 
 
[email protected]("loop_duration, total_tries", [(0.5, 12), (1.0, 7), 
(1.7, 4), (10, 2)])
[email protected](("loop_duration", "total_tries"), [(0.5, 12), (1.0, 
7), (1.7, 4), (10, 2)])
 def test_running_retry_attempt_type(loop_duration, total_tries):
     """
     Verify can_try_again returns True until at least 5 seconds have passed.
diff --git a/airflow-core/tests/unit/executors/test_local_executor.py 
b/airflow-core/tests/unit/executors/test_local_executor.py
index 12aaef6e5de..845f43a8634 100644
--- a/airflow-core/tests/unit/executors/test_local_executor.py
+++ b/airflow-core/tests/unit/executors/test_local_executor.py
@@ -169,7 +169,7 @@ class TestLocalExecutor:
             executor.end()
 
     @pytest.mark.parametrize(
-        ["conf_values", "expected_server"],
+        ("conf_values", "expected_server"),
         [
             (
                 {
diff --git a/airflow-core/tests/unit/jobs/test_base_job.py 
b/airflow-core/tests/unit/jobs/test_base_job.py
index 9f80073007c..a7016541105 100644
--- a/airflow-core/tests/unit/jobs/test_base_job.py
+++ b/airflow-core/tests/unit/jobs/test_base_job.py
@@ -94,7 +94,7 @@ class TestJob:
         assert job.end_date is not None
 
     @pytest.mark.parametrize(
-        "job_runner, job_type,job_heartbeat_sec",
+        ("job_runner", "job_type", "job_heartbeat_sec"),
         [(SchedulerJobRunner, "scheduler", "11"), (TriggererJobRunner, 
"triggerer", "9")],
     )
     def test_heart_rate_after_fetched_from_db(self, job_runner, job_type, 
job_heartbeat_sec):
@@ -116,7 +116,7 @@ class TestJob:
             session.rollback()
 
     @pytest.mark.parametrize(
-        "job_runner, job_type,job_heartbeat_sec",
+        ("job_runner", "job_type", "job_heartbeat_sec"),
         [(SchedulerJobRunner, "scheduler", "11"), (TriggererJobRunner, 
"triggerer", "9")],
     )
     def test_heart_rate_via_constructor_persists(self, job_runner, job_type, 
job_heartbeat_sec):
diff --git a/airflow-core/tests/unit/jobs/test_scheduler_job.py 
b/airflow-core/tests/unit/jobs/test_scheduler_job.py
index e74de5f8e63..275c060f91f 100644
--- a/airflow-core/tests/unit/jobs/test_scheduler_job.py
+++ b/airflow-core/tests/unit/jobs/test_scheduler_job.py
@@ -950,7 +950,7 @@ class TestSchedulerJob:
         session.rollback()
 
     @pytest.mark.parametrize(
-        "state, total_executed_ti",
+        ("state", "total_executed_ti"),
         [
             (DagRunState.SUCCESS, 0),
             (DagRunState.FAILED, 0),
@@ -1824,7 +1824,7 @@ class TestSchedulerJob:
         mock_queue_workload.assert_not_called()
 
     @pytest.mark.parametrize(
-        "task1_exec, task2_exec",
+        ("task1_exec", "task2_exec"),
         [
             ("default_exec", "default_exec"),
             ("default_exec", "secondary_exec"),
@@ -1967,7 +1967,7 @@ class TestSchedulerJob:
             assert ti.state == State.QUEUED
 
     @pytest.mark.parametrize(
-        "task1_exec, task2_exec",
+        ("task1_exec", "task2_exec"),
         [
             ("default_exec", "default_exec"),
             ("default_exec", "secondary_exec"),
@@ -2106,7 +2106,7 @@ class TestSchedulerJob:
         session.rollback()
 
     @pytest.mark.parametrize(
-        "task1_exec, task2_exec",
+        ("task1_exec", "task2_exec"),
         [
             ("default_exec", "default_exec"),
             ("default_exec", "secondary_exec"),
@@ -2641,7 +2641,7 @@ class TestSchedulerJob:
         assert len(dag_runs) == 2
 
     @pytest.mark.parametrize(
-        "ti_state, final_ti_span_status",
+        ("ti_state", "final_ti_span_status"),
         [
             pytest.param(State.SUCCESS, SpanStatus.ENDED, 
id="dr_ended_successfully"),
             pytest.param(State.RUNNING, SpanStatus.ACTIVE, 
id="dr_still_running"),
@@ -2766,7 +2766,7 @@ class TestSchedulerJob:
         assert self.job_runner.active_spans.get("ti:" + ti.id) is None
 
     @pytest.mark.parametrize(
-        "state, final_span_status",
+        ("state", "final_span_status"),
         [
             pytest.param(State.SUCCESS, SpanStatus.ENDED, 
id="dr_ended_successfully"),
             pytest.param(State.RUNNING, SpanStatus.NEEDS_CONTINUANCE, 
id="dr_still_running"),
@@ -2956,7 +2956,7 @@ class TestSchedulerJob:
         )
 
     @pytest.mark.parametrize(
-        "state, expected_callback_msg", [(State.SUCCESS, "success"), 
(State.FAILED, "task_failure")]
+        ("state", "expected_callback_msg"), [(State.SUCCESS, "success"), 
(State.FAILED, "task_failure")]
     )
     def test_dagrun_callbacks_are_called(self, state, expected_callback_msg, 
dag_maker, session):
         """
@@ -3001,7 +3001,7 @@ class TestSchedulerJob:
         session.close()
 
     @pytest.mark.parametrize(
-        "state, expected_callback_msg", [(State.SUCCESS, "success"), 
(State.FAILED, "task_failure")]
+        ("state", "expected_callback_msg"), [(State.SUCCESS, "success"), 
(State.FAILED, "task_failure")]
     )
     def test_dagrun_plugins_are_notified(self, state, expected_callback_msg, 
dag_maker, session):
         """
@@ -3156,7 +3156,7 @@ class TestSchedulerJob:
 
         session.rollback()
 
-    @pytest.mark.parametrize("state, msg", [[State.SUCCESS, "success"], 
[State.FAILED, "task_failure"]])
+    @pytest.mark.parametrize(("state", "msg"), [[State.SUCCESS, "success"], 
[State.FAILED, "task_failure"]])
     def test_dagrun_callbacks_are_added_when_callbacks_are_defined(self, 
state, msg, dag_maker):
         """
         Test if on_*_callback are defined on DAG, Callbacks ARE registered and 
sent to DAG Processor
@@ -3278,7 +3278,7 @@ class TestSchedulerJob:
         assert len(new_tis) == 0
 
     @pytest.mark.parametrize(
-        "ti_states, run_state",
+        ("ti_states", "run_state"),
         [
             (["failed", "success"], "failed"),
             (["success", "success"], "success"),
@@ -4257,7 +4257,7 @@ class TestSchedulerJob:
         assert actual == should_update
 
     @pytest.mark.parametrize(
-        "run_type, expected",
+        ("run_type", "expected"),
         [
             (DagRunType.MANUAL, False),
             (DagRunType.SCHEDULED, True),
@@ -4498,7 +4498,7 @@ class TestSchedulerJob:
 
     @pytest.mark.need_serialized_dag
     @pytest.mark.parametrize(
-        "disable, enable",
+        ("disable", "enable"),
         [
             pytest.param({"is_stale": True}, {"is_stale": False}, id="active"),
             pytest.param({"is_paused": True}, {"is_paused": False}, 
id="paused"),
@@ -5613,7 +5613,7 @@ class TestSchedulerJob:
         assert session.scalar(select(func.count()).where(DagRun.dag_id == 
dag1_dag_id)) == 36
 
     @pytest.mark.parametrize(
-        "pause_it, expected_running",
+        ("pause_it", "expected_running"),
         [
             (True, 0),
             (False, 3),
@@ -5820,7 +5820,7 @@ class TestSchedulerJob:
         assert DagRun.find(run_id="dr1_run_2")[0].state == State.RUNNING
 
     @pytest.mark.parametrize(
-        "state, start_date, end_date",
+        ("state", "start_date", "end_date"),
         [
             [State.NONE, None, None],
             [
@@ -5862,7 +5862,7 @@ class TestSchedulerJob:
             assert ti.state == State.SCHEDULED
 
     @pytest.mark.parametrize(
-        "state,start_date,end_date",
+        ("state", "start_date", "end_date"),
         [
             [State.NONE, None, None],
             [
@@ -5908,7 +5908,7 @@ class TestSchedulerJob:
             assert ti.state == State.SCHEDULED
 
     @pytest.mark.parametrize(
-        "state,start_date,end_date",
+        ("state", "start_date", "end_date"),
         [
             [State.NONE, None, None],
             [
@@ -5954,7 +5954,7 @@ class TestSchedulerJob:
             assert ti.state == State.SCHEDULED
 
     @pytest.mark.parametrize(
-        "state, start_date, end_date",
+        ("state", "start_date", "end_date"),
         [
             [State.NONE, None, None],
             [
@@ -6712,7 +6712,7 @@ class TestSchedulerJob:
         assert [asset.updated_at for asset in orphaned] == 
updated_at_timestamps
 
     @pytest.mark.parametrize(
-        "paused, stale, expected_classpath",
+        ("paused", "stale", "expected_classpath"),
         [
             pytest.param(
                 False,
@@ -6931,7 +6931,7 @@ class TestSchedulerJob:
         assert callback_request.context_from_server.max_tries == ti.max_tries
 
     @pytest.mark.parametrize(
-        "retries,callback_kind,expected",
+        ("retries", "callback_kind", "expected"),
         [
             (1, "retry", TaskInstanceState.UP_FOR_RETRY),
             (0, "failure", TaskInstanceState.FAILED),
@@ -7178,7 +7178,7 @@ class TestSchedulerJobQueriesCount:
         self.clean_db()
 
     @pytest.mark.parametrize(
-        "expected_query_count, dag_count, task_count",
+        ("expected_query_count", "dag_count", "task_count"),
         [
             (21, 1, 1),  # One DAG with one task per DAG file.
             (21, 1, 5),  # One DAG with five tasks per DAG file.
@@ -7244,7 +7244,7 @@ class TestSchedulerJobQueriesCount:
 
     @pytest.mark.flaky(reruns=3, reruns_delay=5)
     @pytest.mark.parametrize(
-        "expected_query_counts, dag_count, task_count, start_ago, schedule, 
shape",
+        ("expected_query_counts", "dag_count", "task_count", "start_ago", 
"schedule", "shape"),
         [
             # One DAG with one task per DAG file.
             ([10, 10, 10, 10], 1, 1, "1d", "None", "no_structure"),
diff --git a/airflow-core/tests/unit/jobs/test_triggerer_job.py 
b/airflow-core/tests/unit/jobs/test_triggerer_job.py
index ea1974637b9..4edbcf21e35 100644
--- a/airflow-core/tests/unit/jobs/test_triggerer_job.py
+++ b/airflow-core/tests/unit/jobs/test_triggerer_job.py
@@ -279,7 +279,7 @@ def test_trigger_lifecycle(spy_agency: SpyAgency, session, 
testing_dag_bundle):
 
 
 @pytest.mark.parametrize(
-    "trigger, watcher_count, trigger_count",
+    ("trigger", "watcher_count", "trigger_count"),
     [
         (TimeDeltaTrigger(datetime.timedelta(days=7)), 0, 1),
         (FileDeleteTrigger("/tmp/foo.txt", poke_interval=1), 1, 0),
diff --git a/airflow-core/tests/unit/lineage/test_hook.py 
b/airflow-core/tests/unit/lineage/test_hook.py
index 1ad5d4f9cf2..26f6b802ff6 100644
--- a/airflow-core/tests/unit/lineage/test_hook.py
+++ b/airflow-core/tests/unit/lineage/test_hook.py
@@ -206,7 +206,7 @@ class FakePlugin(plugins_manager.AirflowPlugin):
 
 
 @pytest.mark.parametrize(
-    "has_readers, expected_class",
+    ("has_readers", "expected_class"),
     [
         (True, HookLineageCollector),
         (False, NoOpCollector),
diff --git a/airflow-core/tests/unit/security/test_kerberos.py 
b/airflow-core/tests/unit/security/test_kerberos.py
index ce80238199d..3fcc05c22f9 100644
--- a/airflow-core/tests/unit/security/test_kerberos.py
+++ b/airflow-core/tests/unit/security/test_kerberos.py
@@ -33,7 +33,7 @@ pytestmark = pytest.mark.db_test
 
 class TestKerberos:
     @pytest.mark.parametrize(
-        "kerberos_config, expected_cmd",
+        ("kerberos_config", "expected_cmd"),
         [
             (
                 {("kerberos", "reinit_frequency"): "42"},

Reply via email to