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

potiuk 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 8e623c4a8d0 Remove defensive bundle/team pre-cleaning from models 
tests (#69342)
8e623c4a8d0 is described below

commit 8e623c4a8d0e1b349665cd80a1c352452a3f97f1
Author: Anish Giri <[email protected]>
AuthorDate: Sun Jul 12 16:25:58 2026 -0500

    Remove defensive bundle/team pre-cleaning from models tests (#69342)
    
    * Remove defensive bundle/team pre-cleaning from models tests
    
    * Move xcom test db cleanup to teardown instead of pre-clean
    
    * Drop redundant pre-clean from models helper-based fixtures
---
 airflow-core/tests/unit/models/test_connection_test.py | 1 -
 airflow-core/tests/unit/models/test_dag.py             | 5 -----
 airflow-core/tests/unit/models/test_dag_version.py     | 1 -
 airflow-core/tests/unit/models/test_dagbundle.py       | 4 ----
 airflow-core/tests/unit/models/test_dagrun.py          | 1 -
 airflow-core/tests/unit/models/test_deadline.py        | 8 --------
 airflow-core/tests/unit/models/test_xcom.py            | 1 +
 7 files changed, 1 insertion(+), 20 deletions(-)

diff --git a/airflow-core/tests/unit/models/test_connection_test.py 
b/airflow-core/tests/unit/models/test_connection_test.py
index a7124e467fd..1c27ac998a8 100644
--- a/airflow-core/tests/unit/models/test_connection_test.py
+++ b/airflow-core/tests/unit/models/test_connection_test.py
@@ -202,7 +202,6 @@ class TestCommitToConnectionTable:
     def setup_teardown(self):
         clear_db_connections(add_default_connections_back=False)
         clear_db_connection_tests()
-        clear_db_teams()
         yield
         clear_db_connections(add_default_connections_back=False)
         clear_db_connection_tests()
diff --git a/airflow-core/tests/unit/models/test_dag.py 
b/airflow-core/tests/unit/models/test_dag.py
index 6a1e9e5782c..25d02d86686 100644
--- a/airflow-core/tests/unit/models/test_dag.py
+++ b/airflow-core/tests/unit/models/test_dag.py
@@ -146,7 +146,6 @@ async def empty_callback_for_deadline():
 def clear_dags():
     clear_db_dags()
     clear_db_serialized_dags()
-    clear_db_dag_bundles()
     yield
     clear_db_dags()
     clear_db_serialized_dags()
@@ -2513,9 +2512,6 @@ class TestDagModel:
         clear_db_dag_bundles()
         clear_db_teams()
 
-    def setup_method(self):
-        self._clean()
-
     def teardown_method(self):
         self._clean()
 
@@ -3318,7 +3314,6 @@ class TestQueries:
     def setup_method(self) -> None:
         clear_db_runs()
         clear_db_dags()
-        clear_db_dag_bundles()
 
     def teardown_method(self) -> None:
         clear_db_runs()
diff --git a/airflow-core/tests/unit/models/test_dag_version.py 
b/airflow-core/tests/unit/models/test_dag_version.py
index da4923d8771..af78736826e 100644
--- a/airflow-core/tests/unit/models/test_dag_version.py
+++ b/airflow-core/tests/unit/models/test_dag_version.py
@@ -37,7 +37,6 @@ pytestmark = pytest.mark.db_test
 class TestDagVersion:
     def setup_method(self):
         clear_db_dags()
-        clear_db_dag_bundles()
 
     def teardown_method(self):
         # clear_db_dags() first: DagModel.bundle_name has an FK to dag_bundle.
diff --git a/airflow-core/tests/unit/models/test_dagbundle.py 
b/airflow-core/tests/unit/models/test_dagbundle.py
index 0c5c5def9d7..c6a2886fa5e 100644
--- a/airflow-core/tests/unit/models/test_dagbundle.py
+++ b/airflow-core/tests/unit/models/test_dagbundle.py
@@ -33,10 +33,6 @@ pytestmark = pytest.mark.db_test
 
 
 class TestDagBundleModel:
-    def setup_method(self):
-        clear_db_dag_bundles()
-        clear_db_teams()
-
     def teardown_method(self):
         clear_db_dag_bundles()
         clear_db_teams()
diff --git a/airflow-core/tests/unit/models/test_dagrun.py 
b/airflow-core/tests/unit/models/test_dagrun.py
index 4ec048a7f4b..3955ac572ef 100644
--- a/airflow-core/tests/unit/models/test_dagrun.py
+++ b/airflow-core/tests/unit/models/test_dagrun.py
@@ -142,7 +142,6 @@ def deadline_test_dag(session):
 class TestDagRun:
     @pytest.fixture(autouse=True)
     def setup_test_cases(self):
-        self._clean_db()
         yield
         self._clean_db()
 
diff --git a/airflow-core/tests/unit/models/test_deadline.py 
b/airflow-core/tests/unit/models/test_deadline.py
index 99f3d9b127b..51e9d208c07 100644
--- a/airflow-core/tests/unit/models/test_deadline.py
+++ b/airflow-core/tests/unit/models/test_deadline.py
@@ -132,10 +132,6 @@ def deadline_orm(dagrun, session):
 
 @pytest.mark.db_test
 class TestDeadline:
-    @staticmethod
-    def setup_method():
-        _clean_db()
-
     @staticmethod
     def teardown_method():
         _clean_db()
@@ -322,10 +318,6 @@ class TestDeadline:
 
 @pytest.mark.db_test
 class TestCalculatedDeadlineDatabaseCalls:
-    @staticmethod
-    def setup_method():
-        _clean_db()
-
     @staticmethod
     def teardown_method():
         _clean_db()
diff --git a/airflow-core/tests/unit/models/test_xcom.py 
b/airflow-core/tests/unit/models/test_xcom.py
index 2635aac1803..d496b67a7de 100644
--- a/airflow-core/tests/unit/models/test_xcom.py
+++ b/airflow-core/tests/unit/models/test_xcom.py
@@ -56,6 +56,7 @@ class CustomXCom(BaseXCom): ...
 @pytest.fixture(autouse=True)
 def reset_db():
     """Reset XCom entries."""
+    yield
     clear_db_dags()
     clear_db_runs()
     clear_db_xcom()

Reply via email to