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 0478e24957 Ignore exceptions when closing all sessions in tests 
(#40143)
0478e24957 is described below

commit 0478e2495721a7822474124962141acb970b5c20
Author: Jarek Potiuk <[email protected]>
AuthorDate: Sat Jun 8 19:36:46 2024 +0200

    Ignore exceptions when closing all sessions in tests (#40143)
    
    Sometimes there are some races when connections are closed resulting
    in session being None. This is not a problem in general - because it
    means that sessions have been closed, so we should ignore errors
    in this case.
---
 tests/conftest.py | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/tests/conftest.py b/tests/conftest.py
index 65fb0d9925..912ebfbe23 100644
--- a/tests/conftest.py
+++ b/tests/conftest.py
@@ -1272,9 +1272,11 @@ def initialize_providers_manager():
 def close_all_sqlalchemy_sessions():
     from sqlalchemy.orm import close_all_sessions
 
-    close_all_sessions()
+    with suppress(Exception):
+        close_all_sessions()
     yield
-    close_all_sessions()
+    with suppress(Exception):
+        close_all_sessions()
 
 
 @pytest.fixture

Reply via email to