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

vatsrahul1001 pushed a commit to branch v3-4-test
in repository https://gitbox.apache.org/repos/asf/airflow.git

commit bb8a9336e19429623624e4c355ba8c9fe7e3d439
Author: github-actions[bot] 
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Sun Nov 1 20:49:11 2026 +0100

    [v3-4-test] Keep executor loader tests patched after another test reloads 
the module (#76233) (#76248)
    
    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.
    (cherry picked from commit a7c481d84cc10ce8f1261030302a3ae456663bb5)
    
    
    Generated-by: Claude Opus 5
    
    Co-authored-by: Jarek Potiuk <[email protected]>
---
 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