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 515179fe67 Cleanup all sqlalchemy sessions before each test (#33190)
515179fe67 is described below
commit 515179fe67c0c6bd8b693c5ab313f4a0cfbacea7
Author: Jarek Potiuk <[email protected]>
AuthorDate: Tue Aug 8 17:02:10 2023 +0200
Cleanup all sqlalchemy sessions before each test (#33190)
Attempt to solve some of the flakiness we saw recently - this
change will run closing all opened sqlalchemy sessions before each
test. This should be a little slower than before - especially
for the very fast tests, but it provide us with much better
isolation between the tests - thus avoiding the flakiness
that we observe recently - as documented in #33178
Hopefully this one
Fixes: #33178
---
tests/conftest.py | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/tests/conftest.py b/tests/conftest.py
index 49733a7da4..2b431f1772 100644
--- a/tests/conftest.py
+++ b/tests/conftest.py
@@ -942,3 +942,12 @@ def initialize_providers_manager():
from airflow.providers_manager import ProvidersManager
ProvidersManager().initialize_providers_configuration()
+
+
[email protected](autouse=True, scope="function")
+def close_all_sqlalchemy_sessions():
+ from sqlalchemy.orm import close_all_sessions
+
+ close_all_sessions()
+ yield
+ close_all_sessions()