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 a7c481d84cc Keep executor loader tests patched after another test 
reloads the module (#76233)
a7c481d84cc is described below

commit a7c481d84cc10ce8f1261030302a3ae456663bb5
Author: Jarek Potiuk <[email protected]>
AuthorDate: Sun Nov 1 20:46:35 2026 +0100

    Keep executor loader tests patched after another test reloads the module 
(#76233)
    
    The non-DB core test job failed on v3-4-test when a test that reloads
    executor_loader (test_standalone_command) ran on the same xdist worker
    before test_resolve_executor_name: the decorator patched the class
    object bound at import time, the test then called the reloaded class,
    and the real team validation reached the database.
    
    Generated-by: Claude Opus 5
---
 airflow-core/tests/unit/executors/test_executor_loader.py | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/airflow-core/tests/unit/executors/test_executor_loader.py 
b/airflow-core/tests/unit/executors/test_executor_loader.py
index 550e0fa708f..63d74884500 100644
--- a/airflow-core/tests/unit/executors/test_executor_loader.py
+++ b/airflow-core/tests/unit/executors/test_executor_loader.py
@@ -776,7 +776,9 @@ class TestExecutorLoader:
         ],
     )
     @conf_vars(TEAM_EXECUTORS_CONFIG)
-    @patch.object(executor_loader.ExecutorLoader, 
"_validate_teams_exist_in_database")
+    # A dotted path, not patch.object: other tests reload executor_loader, and 
a decorator binds the
+    # class object at import time, so the patch would land on a class the test 
no longer calls.
+    
@patch("airflow.executors.executor_loader.ExecutorLoader._validate_teams_exist_in_database")
     def test_resolve_executor_name(self, _, executor, team_name, expected):
         name = executor_loader.ExecutorLoader.resolve_executor_name(executor, 
team_name)
         assert (name.alias or name.module_path, name.team_name) == expected
@@ -790,7 +792,7 @@ class TestExecutorLoader:
         ],
     )
     @conf_vars(TEAM_EXECUTORS_CONFIG)
-    @patch.object(executor_loader.ExecutorLoader, 
"_validate_teams_exist_in_database")
+    
@patch("airflow.executors.executor_loader.ExecutorLoader._validate_teams_exist_in_database")
     def test_resolve_executor_name_no_match(self, _, executor, team_name):
         with pytest.raises(UnknownExecutorException):
             executor_loader.ExecutorLoader.resolve_executor_name(executor, 
team_name)

Reply via email to