This is an automated email from the ASF dual-hosted git repository.
shahar1 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 d72dd42520a Remove orphaned model, asset and timetable test helpers
(#75887)
d72dd42520a is described below
commit d72dd42520a8413d4b83cf477338240d52149633
Author: Hussein Awala <[email protected]>
AuthorDate: Thu Oct 29 06:20:18 2026 +0100
Remove orphaned model, asset and timetable test helpers (#75887)
---
airflow-core/tests/unit/assets/test_manager.py | 10 +-----
airflow-core/tests/unit/models/test_dag.py | 14 --------
.../tests/unit/models/test_taskinstance.py | 38 ----------------------
.../tests/unit/timetables/test_assets_timetable.py | 18 ----------
4 files changed, 1 insertion(+), 79 deletions(-)
diff --git a/airflow-core/tests/unit/assets/test_manager.py
b/airflow-core/tests/unit/assets/test_manager.py
index c700605c24f..f940f203912 100644
--- a/airflow-core/tests/unit/assets/test_manager.py
+++ b/airflow-core/tests/unit/assets/test_manager.py
@@ -18,7 +18,6 @@
from __future__ import annotations
import concurrent.futures
-import itertools
import logging
import threading
from collections import Counter
@@ -46,7 +45,7 @@ from airflow.models.asset import (
DagScheduleAssetUriReference,
PartitionedAssetKeyLog,
)
-from airflow.models.dag import DAG, DagModel
+from airflow.models.dag import DagModel
from airflow.models.dagbundle import DagBundleModel
from airflow.models.log import Log
from airflow.models.team import Team
@@ -97,13 +96,6 @@ def mock_task_instance():
return None
-def create_mock_dag():
- for dag_id in itertools.count(1):
- mock_dag = mock.Mock(spec=DAG)
- mock_dag.dag_id = dag_id
- yield mock_dag
-
-
def _clear_partition_db() -> None:
clear_db_apdr()
clear_db_pakl()
diff --git a/airflow-core/tests/unit/models/test_dag.py
b/airflow-core/tests/unit/models/test_dag.py
index 54b3571bd5f..9c6b6754db6 100644
--- a/airflow-core/tests/unit/models/test_dag.py
+++ b/airflow-core/tests/unit/models/test_dag.py
@@ -400,20 +400,6 @@ class TestDag:
clear_db_dags()
clear_db_assets()
- @staticmethod
- def _occur_before(a, b, list_):
- """
- Assert that a occurs before b in the list.
- """
- a_index = -1
- b_index = -1
- for i, e in enumerate(list_):
- if e.task_id == a:
- a_index = i
- if e.task_id == b:
- b_index = i
- return 0 <= a_index < b_index
-
def test_dag_naive_default_args_start_date(self):
dag = DAG("DAG", schedule=None, default_args={"start_date":
datetime.datetime(2018, 1, 1)})
assert dag.timezone == settings.TIMEZONE
diff --git a/airflow-core/tests/unit/models/test_taskinstance.py
b/airflow-core/tests/unit/models/test_taskinstance.py
index 8087538ff8b..18e692cdaf3 100644
--- a/airflow-core/tests/unit/models/test_taskinstance.py
+++ b/airflow-core/tests/unit/models/test_taskinstance.py
@@ -21,7 +21,6 @@ import contextlib
import datetime
import json
import operator
-import os
import pathlib
import re
from typing import TYPE_CHECKING, cast
@@ -2818,17 +2817,6 @@ class TestTaskInstance:
run_task_instance(ti, task)
assert ti.state == State.UP_FOR_RETRY
- def _env_var_check_callback(self):
- assert os.environ["AIRFLOW_CTX_DAG_ID"] == "test_echo_env_variables"
- assert os.environ["AIRFLOW_CTX_TASK_ID"] == "hive_in_python_op"
- assert DEFAULT_DATE.isoformat() ==
os.environ["AIRFLOW_CTX_LOGICAL_DATE"]
- assert (
- DagRun.generate_run_id(
- run_type=DagRunType.MANUAL, logical_date=DEFAULT_DATE,
run_after=DEFAULT_DATE
- )
- == os.environ["AIRFLOW_CTX_DAG_RUN_ID"]
- )
-
def test_set_state_up_for_retry(self, create_task_instance):
ti = create_task_instance(state=State.RUNNING)
@@ -4284,32 +4272,6 @@ class TestMappedTaskInstanceReceiveValue:
)
-def _get_lazy_xcom_access_expected_sql_lines() -> list[str]:
- backend = os.environ.get("BACKEND")
- if backend == "mysql":
- return [
- "SELECT xcom.value",
- "FROM xcom",
- "WHERE xcom.dag_id = 'test_dag' AND xcom.run_id = 'test' "
- "AND xcom.task_id = 't' AND xcom.map_index = -1 AND xcom.`key` =
'xxx'",
- ]
- if backend == "postgres":
- return [
- "SELECT xcom.value",
- "FROM xcom",
- "WHERE xcom.dag_id = 'test_dag' AND xcom.run_id = 'test' "
- "AND xcom.task_id = 't' AND xcom.map_index = -1 AND xcom.key =
'xxx'",
- ]
- if backend == "sqlite":
- return [
- "SELECT xcom.value",
- "FROM xcom",
- "WHERE xcom.dag_id = 'test_dag' AND xcom.run_id = 'test' "
- "AND xcom.task_id = 't' AND xcom.map_index = -1 AND xcom.\"key\" =
'xxx'",
- ]
- raise RuntimeError(f"unknown backend {backend!r}")
-
-
def test_expand_non_templated_field(dag_maker, session):
"""Test expand on non-templated fields sets upstream deps properly."""
diff --git a/airflow-core/tests/unit/timetables/test_assets_timetable.py
b/airflow-core/tests/unit/timetables/test_assets_timetable.py
index 7f4b41e578c..398c29fcbe2 100644
--- a/airflow-core/tests/unit/timetables/test_assets_timetable.py
+++ b/airflow-core/tests/unit/timetables/test_assets_timetable.py
@@ -148,24 +148,6 @@ class CustomAssetGatedTimetable(MockTimetable):
asset_gated = True
-def serialize_timetable(timetable: Timetable) -> str:
- """
- Mock serialization function for Timetable objects.
-
- :param timetable: The Timetable object to serialize.
- """
- return "serialized_timetable"
-
-
-def deserialize_timetable(serialized: str) -> MockTimetable:
- """
- Mock deserialization function for Timetable objects.
-
- :param serialized: The serialized data of the timetable.
- """
- return MockTimetable()
-
-
@pytest.fixture
def test_timetable() -> MockTimetable:
"""Pytest fixture for creating a MockTimetable object."""