This is an automated email from the ASF dual-hosted git repository.
ferruzzi 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 eeff07b7ea7 Enable PT006 rule to airflow-core tests(triggers,
timetables) (#57888)
eeff07b7ea7 is described below
commit eeff07b7ea7b6cb73015d1a23d36f5ae45d6e75c
Author: Xch1 <[email protected]>
AuthorDate: Thu Nov 6 13:17:29 2025 +0800
Enable PT006 rule to airflow-core tests(triggers, timetables) (#57888)
Co-authored-by: Kalyan R <[email protected]>
Signed-off-by: Xch1 <[email protected]>
---
.../tests/unit/timetables/test_events_timetable.py | 4 ++--
.../unit/timetables/test_interval_timetable.py | 8 +++----
.../tests/unit/timetables/test_once_timetable.py | 2 +-
.../unit/timetables/test_trigger_timetable.py | 26 +++++++++++-----------
.../unit/timetables/test_workday_timetable.py | 4 ++--
airflow-core/tests/unit/triggers/test_callback.py | 2 +-
6 files changed, 23 insertions(+), 23 deletions(-)
diff --git a/airflow-core/tests/unit/timetables/test_events_timetable.py
b/airflow-core/tests/unit/timetables/test_events_timetable.py
index 556f5d725b4..9d42d5ddc6c 100644
--- a/airflow-core/tests/unit/timetables/test_events_timetable.py
+++ b/airflow-core/tests/unit/timetables/test_events_timetable.py
@@ -65,7 +65,7 @@ def restricted_timetable():
@pytest.mark.parametrize(
- "start, end",
+ ("start", "end"),
list(zip(EVENT_DATES, EVENT_DATES)),
)
def test_dag_run_info_interval(start: pendulum.DateTime, end:
pendulum.DateTime):
@@ -101,7 +101,7 @@ def
test_manual_with_restricted_before(restricted_timetable: Timetable, restrict
@pytest.mark.parametrize(
- "last_automated_data_interval, expected_next_info",
+ ("last_automated_data_interval", "expected_next_info"),
[
pytest.param(None, DagRunInfo.interval(START_DATE, START_DATE)),
pytest.param(
diff --git a/airflow-core/tests/unit/timetables/test_interval_timetable.py
b/airflow-core/tests/unit/timetables/test_interval_timetable.py
index 87a23ba24a7..5fc836e23fd 100644
--- a/airflow-core/tests/unit/timetables/test_interval_timetable.py
+++ b/airflow-core/tests/unit/timetables/test_interval_timetable.py
@@ -145,7 +145,7 @@ def test_validate_success(timetable: Timetable) -> None:
@pytest.mark.parametrize(
- "timetable, error_message",
+ ("timetable", "error_message"),
[
pytest.param(
CronDataIntervalTimetable("0 0 1 13 0", utc),
@@ -191,7 +191,7 @@ def test_cron_interval_serialize():
@pytest.mark.parametrize(
- "timetable, expected_data",
+ ("timetable", "expected_data"),
[
(HOURLY_RELATIVEDELTA_TIMETABLE, {"delta": {"hours": 1}}),
(HOURLY_TIMEDELTA_TIMETABLE, {"delta": 3600.0}),
@@ -206,7 +206,7 @@ def test_delta_interval_serialize(timetable, expected_data):
@pytest.mark.parametrize(
- "trigger_at, expected_interval",
+ ("trigger_at", "expected_interval"),
[
# Arbitrary trigger time.
pytest.param(
@@ -237,7 +237,7 @@ def test_cron_infer_manual_data_interval_alignment(
@pytest.mark.parametrize(
- "last_data_interval, expected_info",
+ ("last_data_interval", "expected_info"),
[
pytest.param(
DataInterval(
diff --git a/airflow-core/tests/unit/timetables/test_once_timetable.py
b/airflow-core/tests/unit/timetables/test_once_timetable.py
index 0ca84229ba6..f2bf51dd0f1 100644
--- a/airflow-core/tests/unit/timetables/test_once_timetable.py
+++ b/airflow-core/tests/unit/timetables/test_once_timetable.py
@@ -33,7 +33,7 @@ PREVIOUS_INFO = DagRunInfo.exact(FROZEN_NOW -
datetime.timedelta(days=1))
@pytest.mark.parametrize(
- "prev_info, end_date, expected_next_info",
+ ("prev_info", "end_date", "expected_next_info"),
[
(None, None, DagRunInfo.exact(FROZEN_NOW)),
(None, FROZEN_NOW + datetime.timedelta(days=1),
DagRunInfo.exact(FROZEN_NOW)),
diff --git a/airflow-core/tests/unit/timetables/test_trigger_timetable.py
b/airflow-core/tests/unit/timetables/test_trigger_timetable.py
index 3a0a60cebfe..eecd2bdfb0a 100644
--- a/airflow-core/tests/unit/timetables/test_trigger_timetable.py
+++ b/airflow-core/tests/unit/timetables/test_trigger_timetable.py
@@ -50,7 +50,7 @@ DELTA_FROM_MIDNIGHT = datetime.timedelta(minutes=30, hours=16)
@pytest.mark.parametrize(
- "last_automated_data_interval, next_start_time",
+ ("last_automated_data_interval", "next_start_time"),
[
pytest.param(
None,
@@ -88,7 +88,7 @@ def
test_daily_cron_trigger_no_catchup_first_starts_at_next_schedule(
@pytest.mark.parametrize(
- "last_automated_data_interval, next_start_time",
+ ("last_automated_data_interval", "next_start_time"),
[
pytest.param(
None,
@@ -129,7 +129,7 @@ def
test_daily_delta_trigger_no_catchup_first_starts_at_next_schedule(
@pytest.mark.parametrize(
- "current_time, earliest, expected",
+ ("current_time", "earliest", "expected"),
[
pytest.param(
pendulum.DateTime(2022, 7, 27, 0, 0, 0, tzinfo=utc),
@@ -177,7 +177,7 @@ def test_hourly_cron_trigger_no_catchup_next_info(
@pytest.mark.parametrize(
- "current_time, earliest, expected",
+ ("current_time", "earliest", "expected"),
[
pytest.param(
pendulum.DateTime(2022, 7, 27, 0, 0, 0, tzinfo=utc),
@@ -233,7 +233,7 @@ def test_hourly_delta_trigger_no_catchup_next_info(
@pytest.mark.parametrize(
- "last_automated_data_interval, earliest, expected",
+ ("last_automated_data_interval", "earliest", "expected"),
[
pytest.param(
DataInterval.exact(pendulum.DateTime(2022, 7, 27, 0, 0, 0,
tzinfo=utc)),
@@ -274,7 +274,7 @@ def test_hourly_cron_trigger_catchup_next_info(
@pytest.mark.parametrize(
- "last_automated_data_interval, earliest, expected",
+ ("last_automated_data_interval", "earliest", "expected"),
[
pytest.param(
DataInterval.exact(pendulum.DateTime(2022, 7, 27, 0, 0, 0,
tzinfo=utc)),
@@ -356,7 +356,7 @@ def test_validate_success(timetable: Timetable) -> None:
@pytest.mark.parametrize(
- "timetable, message",
+ ("timetable", "message"),
[
pytest.param(
CronTriggerTimetable("0 0 1 13 0", timezone=utc),
@@ -382,7 +382,7 @@ def test_validate_failure(timetable: Timetable, message:
str) -> None:
@pytest.mark.parametrize(
- "timetable, data",
+ ("timetable", "data"),
[
pytest.param(
HOURLY_CRON_TRIGGER_TIMETABLE,
@@ -425,7 +425,7 @@ def test_cron_trigger_serialization(timetable:
CronTriggerTimetable, data: dict[
@pytest.mark.parametrize(
- "timetable, data",
+ ("timetable", "data"),
[
pytest.param(
HOURLY_TIMEDELTA_TIMETABLE,
@@ -472,7 +472,7 @@ NEXT = DagRunInfo.exact(pendulum.datetime(year=2024,
month=8, day=16, hour=3))
@pytest.mark.parametrize("catchup", [True, False])
@pytest.mark.parametrize(
- "run_immediately, current_time, correct_interval",
+ ("run_immediately", "current_time", "correct_interval"),
[
(True, WAY_AFTER, PREVIOUS),
(False, JUST_AFTER, PREVIOUS),
@@ -511,7 +511,7 @@ def test_run_immediately_fast_dag(catchup):
@pytest.mark.parametrize(
- "start_date, expected",
+ ("start_date", "expected"),
[
(pendulum.datetime(2025, 1, 1), pendulum.datetime(2025, 1, 1)),
(pendulum.datetime(2025, 1, 1, minute=5), pendulum.datetime(2025, 1,
1, minute=30)),
@@ -528,7 +528,7 @@ def test_multi_run_first(start_date, expected):
@pytest.mark.parametrize(
- "last, expected",
+ ("last", "expected"),
[
(pendulum.datetime(2025, 1, 1), pendulum.datetime(2025, 1, 1,
minute=30)),
(pendulum.datetime(2025, 1, 1, minute=30), pendulum.datetime(2025, 1,
1, hour=1)),
@@ -544,7 +544,7 @@ def test_multi_run_next_catchup(last, expected):
@pytest.mark.parametrize(
- "last, current_time, expected",
+ ("last", "current_time", "expected"),
[
pytest.param(
pendulum.datetime(2025, 2, 1),
diff --git a/airflow-core/tests/unit/timetables/test_workday_timetable.py
b/airflow-core/tests/unit/timetables/test_workday_timetable.py
index 7c91d16aeb4..aadf8e67a2f 100644
--- a/airflow-core/tests/unit/timetables/test_workday_timetable.py
+++ b/airflow-core/tests/unit/timetables/test_workday_timetable.py
@@ -53,7 +53,7 @@ def timetable():
@pytest.mark.parametrize(
- "start, end",
+ ("start", "end"),
list(zip(WEEK_1_WEEKDAYS[:-1], WEEK_1_WEEKDAYS[1:])),
)
def test_dag_run_info_interval(start: pendulum.DateTime, end:
pendulum.DateTime):
@@ -71,7 +71,7 @@ def test_first_schedule(timetable: Timetable, restriction:
TimeRestriction):
@pytest.mark.parametrize(
- "last_automated_data_interval, expected_next_info",
+ ("last_automated_data_interval", "expected_next_info"),
[
pytest.param(
DataInterval(day, day + datetime.timedelta(days=1)),
diff --git a/airflow-core/tests/unit/triggers/test_callback.py
b/airflow-core/tests/unit/triggers/test_callback.py
index 9155aea9207..ca59ea735f8 100644
--- a/airflow-core/tests/unit/triggers/test_callback.py
+++ b/airflow-core/tests/unit/triggers/test_callback.py
@@ -52,7 +52,7 @@ class TestCallbackTrigger:
yield m
@pytest.mark.parametrize(
- "callback_init_kwargs,expected_serialized_kwargs",
+ ("callback_init_kwargs", "expected_serialized_kwargs"),
[
pytest.param(None, {}, id="no kwargs"),
pytest.param(TEST_CALLBACK_KWARGS, TEST_CALLBACK_KWARGS,
id="non-empty kwargs"),