Skip to content

Commit b425b31

Browse files
committed
fix: add loop_scope="session" to integration tests to fix AsyncMongoClient event loop error
Add loop_scope="session" to all test decorators in test_trigger_deduplication.py to ensure tests run in the same event loop as the session-scoped app_started fixture. This fixes "Cannot use AsyncMongoClient in different event loop" errors. Signed-off-by: Sparsh <sparsh.raj30@gmail.com>
1 parent 8142f52 commit b425b31

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

state-manager/tests/unit/with_database/test_trigger_deduplication.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
from app.tasks.verify_graph import create_crons
1414

1515

16-
@pytest.mark.asyncio
16+
@pytest.mark.asyncio(loop_scope="session")
1717
async def test_create_crons_deduplicates_identical_triggers(app_started):
1818
"""Test that create_crons deduplicates triggers with identical expression and timezone
1919
@@ -72,7 +72,7 @@ async def test_create_crons_deduplicates_identical_triggers(app_started):
7272
).delete_many()
7373

7474

75-
@pytest.mark.asyncio
75+
@pytest.mark.asyncio(loop_scope="session")
7676
async def test_create_crons_keeps_triggers_with_different_timezones(app_started):
7777
"""Test that create_crons keeps triggers with same expression but different timezones
7878
@@ -129,7 +129,7 @@ async def test_create_crons_keeps_triggers_with_different_timezones(app_started)
129129
).delete_many()
130130

131131

132-
@pytest.mark.asyncio
132+
@pytest.mark.asyncio(loop_scope="session")
133133
async def test_create_crons_keeps_triggers_with_different_expressions(app_started):
134134
"""Test that create_crons keeps triggers with different expressions
135135
@@ -185,7 +185,7 @@ async def test_create_crons_keeps_triggers_with_different_expressions(app_starte
185185
).delete_many()
186186

187187

188-
@pytest.mark.asyncio
188+
@pytest.mark.asyncio(loop_scope="session")
189189
async def test_create_crons_complex_deduplication_scenario(app_started):
190190
"""Test complex deduplication scenario with mix of duplicates and unique triggers
191191

0 commit comments

Comments
 (0)