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

ephraimanierobi 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 eba04d7c40 tests: always cleanup registered test listeners (#27896)
eba04d7c40 is described below

commit eba04d7c400c0d89492d75a7c81d21073933cd0c
Author: Maciej Obuchowski <[email protected]>
AuthorDate: Thu Nov 24 18:24:31 2022 +0100

    tests: always cleanup registered test listeners (#27896)
    
    Signed-off-by: Maciej Obuchowski <[email protected]>
    
    Signed-off-by: Maciej Obuchowski <[email protected]>
---
 tests/plugins/test_plugins_manager.py               | 1 +
 tests/task/task_runner/test_standard_task_runner.py | 2 ++
 2 files changed, 3 insertions(+)

diff --git a/tests/plugins/test_plugins_manager.py 
b/tests/plugins/test_plugins_manager.py
index 9ed00cae05..9ae6f55b6b 100644
--- a/tests/plugins/test_plugins_manager.py
+++ b/tests/plugins/test_plugins_manager.py
@@ -65,6 +65,7 @@ class AirflowTestOnLoadExceptionPlugin(AirflowPlugin):
 
 @pytest.fixture(autouse=True, scope="module")
 def clean_plugins():
+    get_listener_manager().clear()
     yield
     get_listener_manager().clear()
 
diff --git a/tests/task/task_runner/test_standard_task_runner.py 
b/tests/task/task_runner/test_standard_task_runner.py
index c54a27ae89..797462136a 100644
--- a/tests/task/task_runner/test_standard_task_runner.py
+++ b/tests/task/task_runner/test_standard_task_runner.py
@@ -72,6 +72,7 @@ class TestStandardTaskRunner:
         (as the test environment does not have enough context for the normal
         way to run) and ensures they reset back to normal on the way out.
         """
+        get_listener_manager().clear()
         clear_db_runs()
         dictConfig(LOGGING_CONFIG)
         yield
@@ -79,6 +80,7 @@ class TestStandardTaskRunner:
         airflow_logger.handlers = []
         clear_db_runs()
         dictConfig(DEFAULT_LOGGING_CONFIG)
+        get_listener_manager().clear()
 
     def test_start_and_terminate(self):
         local_task_job = mock.Mock()

Reply via email to