Skip to content

Commit f3fb932

Browse files
committed
add db session bulk fixture
Add notify_db_session_bulk fixture to yield _notify_db.session_bulk for tests that need to run against the bulk/replica database. Ensures cleanup after each test by invoking _clean_database(_notify_db), keeping behaviour consistent with notify_db_session.
1 parent aae5d26 commit f3fb932

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

tests/conftest.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,17 @@ def sms_providers(_notify_db):
143143
get_provider_details_by_identifier("firetext").priority = 0
144144

145145

146+
@pytest.fixture(scope="function")
147+
def notify_db_session_bulk(_notify_db, sms_providers):
148+
"""
149+
This fixture clears down all non static data after your test run. It yields the SQLAlchemy bulk session variable,
150+
which is used for bulk/replica DB operations. Use this session to manually route queries to the replica database.
151+
"""
152+
yield _notify_db.session_bulk
153+
154+
_clean_database(_notify_db)
155+
156+
146157
@pytest.fixture(scope="function")
147158
def notify_db_session(_notify_db, sms_providers):
148159
"""

0 commit comments

Comments
 (0)